[grpc] Upgrade to gRPC-1.26.0 (#9363)

* WIP - Upgrade gRPC to 1.26.0

* Updated patch 00001

* Update 00002 patch.

* Update 00003

* Update 00005

* Remove 00007 patch.

* Really fix patch 00005

* Use CRLF for patches as before 🤷
This commit is contained in:
Carlos O'Ryan 2020-01-06 15:24:51 -05:00 committed by dan-shaw
parent 1f88f2098b
commit ebe505081b
7 changed files with 42 additions and 139 deletions

View File

@ -1,8 +1,8 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e49b3cc07d..74bbd3294f 100644
index 3d4418a..a2f23d5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -92,6 +92,9 @@ if(UNIX)
@@ -104,6 +104,9 @@ if(UNIX)
endif()
if(WIN32)
set(_gRPC_PLATFORM_WINDOWS ON)
@ -12,17 +12,17 @@ index e49b3cc07d..74bbd3294f 100644
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
@@ -107,6 +110,9 @@ if (MSVC)
add_definitions(/wd4267)
@@ -119,6 +122,9 @@ if(MSVC)
set(_gRPC_C_CXX_FLAGS "${_gRPC_C_CXX_FLAGS} /wd4267")
# TODO(jtattermusch): needed to build boringssl with VS2017, revisit later
add_definitions(/wd4987 /wd4774 /wd4819 /wd4996 /wd4619)
set(_gRPC_C_CXX_FLAGS "${_gRPC_C_CXX_FLAGS} /wd4987 /wd4774 /wd4819 /wd4996 /wd4619")
+ if(_gRPC_PLATFORM_UWP)
+ add_definitions(-DGRPC_ARES=0)
+ endif()
endif()
if (gRPC_USE_PROTO_LITE)
@@ -172,6 +178,10 @@ file(MAKE_DIRECTORY ${_gRPC_PROTO_GENS_DIR})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_gRPC_C_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_gRPC_C_CXX_FLAGS}")
@@ -186,6 +192,10 @@ file(MAKE_DIRECTORY ${_gRPC_PROTO_GENS_DIR})
# ``.proto`` files
#
function(protobuf_generate_grpc_cpp)
@ -33,77 +33,27 @@ index e49b3cc07d..74bbd3294f 100644
if(NOT ARGN)
message(SEND_ERROR "Error: PROTOBUF_GENERATE_GRPC_CPP() called without any proto files")
return()
@@ -213,6 +223,7 @@ function(protobuf_generate_grpc_cpp)
endforeach()
endfunction()
@@ -258,6 +268,7 @@ if (gRPC_BUILD_GRPC_RUBY_PLUGIN)
list(APPEND _gRPC_PLUGIN_LIST grpc_ruby_plugin)
endif ()
+if(NOT _gRPC_PLATFORM_UWP)
add_custom_target(plugins
DEPENDS
grpc_cpp_plugin
@@ -242,6 +253,8 @@ add_custom_target(tools_cxx
DEPENDS ${_gRPC_PLUGIN_LIST}
)
@@ -279,6 +290,7 @@ add_custom_target(tools_cxx
add_custom_target(tools
DEPENDS tools_c tools_cxx)
+endif()
+
if (gRPC_BUILD_TESTS)
add_custom_target(buildtests_c)
add_dependencies(buildtests_c algorithm_test)
@@ -3622,7 +3635,6 @@ foreach(_hdr
DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}"
)
endforeach()
-endif (gRPC_BUILD_CODEGEN)
if (gRPC_BUILD_CODEGEN)
@@ -3633,6 +3645,7 @@ if (gRPC_INSTALL)
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
)
endif()
+endif (gRPC_BUILD_CODEGEN)
endif (gRPC_BUILD_CODEGEN)
if (gRPC_BUILD_TESTS)
@@ -3760,7 +3773,6 @@ foreach(_hdr
DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}"
)
endforeach()
-endif (gRPC_BUILD_CODEGEN)
if (gRPC_BUILD_CODEGEN)
@@ -3771,6 +3783,7 @@ if (gRPC_INSTALL)
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
)
endif()
+endif (gRPC_BUILD_CODEGEN)
endif (gRPC_BUILD_CODEGEN)
if (gRPC_BUILD_TESTS)
@@ -4845,7 +4858,7 @@ foreach(_hdr
DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}"
)
endforeach()
-endif (gRPC_BUILD_CODEGEN)
+
if (gRPC_BUILD_CODEGEN)
@@ -4856,6 +4869,7 @@ if (gRPC_INSTALL)
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
)
endif()
+endif (gRPC_BUILD_CODEGEN)
endif (gRPC_BUILD_CODEGEN)
if (gRPC_BUILD_TESTS)
protobuf_generate_grpc_cpp(
src/proto/grpc/channelz/channelz.proto
diff --git a/src/core/lib/iomgr/resource_quota.cc b/src/core/lib/iomgr/resource_quota.cc
index dffac348c5..a59becb046 100644
index 0fc0279..aaf2b09 100644
--- a/src/core/lib/iomgr/resource_quota.cc
+++ b/src/core/lib/iomgr/resource_quota.cc
@@ -940,7 +940,7 @@ void grpc_resource_user_alloc(grpc_resource_user* resource_user, size_t size,
@@ -945,7 +945,7 @@ bool grpc_resource_user_alloc(grpc_resource_user* resource_user, size_t size,
void grpc_resource_user_free(grpc_resource_user* resource_user, size_t size) {
gpr_mu_lock(&resource_user->mu);
grpc_resource_quota* resource_quota = resource_user->resource_quota;
@ -113,36 +63,24 @@ index dffac348c5..a59becb046 100644
bool was_zero_or_negative = resource_user->free_pool <= 0;
resource_user->free_pool += static_cast<int64_t>(size);
diff --git a/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc b/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc
index 55efe0e9dd..f538f26edf 100644
index 59432cf..fed574d 100644
--- a/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc
+++ b/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc
@@ -60,6 +60,8 @@ bool check_bios_data(const char* bios_data_file) {
static void init_mu(void) { gpr_mu_init(&g_mu); }
@@ -39,6 +39,7 @@ bool check_bios_data(const char*) { return false; }
bool check_windows_registry_product_name(HKEY root_key,
const char* reg_key_path,
const char* reg_key_name) {
+#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP
+
static bool run_powershell() {
SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(sa);
@@ -97,8 +99,12 @@ static bool run_powershell() {
CloseHandle(h);
return true;
}
+#endif
const size_t kProductNameBufferSize = 256;
char const expected_substr[] = "Google";
bool grpc_alts_is_running_on_gcp() {
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+ g_is_on_compute_engine = false;
+#else
gpr_once_init(&g_once, init_mu);
gpr_mu_lock(&g_mu);
if (!g_compute_engine_detection_done) {
@@ -108,6 +114,7 @@ bool grpc_alts_is_running_on_gcp() {
g_compute_engine_detection_done = true;
@@ -71,6 +72,9 @@ bool check_windows_registry_product_name(HKEY root_key,
}
gpr_mu_unlock(&g_mu);
return strstr(buffer, expected_substr) != nullptr;
+#else
+ return false;
+#endif
return g_is_on_compute_engine;
}
} // namespace internal

View File

@ -1,8 +1,8 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 74bbd3294f..f6c4a340fc 100644
index a2f23d5..e433e8d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,6 +99,11 @@ endif()
@@ -111,6 +111,11 @@ endif()
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
@ -11,6 +11,6 @@ index 74bbd3294f..f6c4a340fc 100644
+ set(CMAKE_EXE_LINKER_FLAGS "-Bstatic")
+endif()
+
if (MSVC)
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)

View File

@ -1,8 +1,8 @@
diff --git a/src/core/lib/transport/transport.cc b/src/core/lib/transport/transport.cc
index 29c1e56..29de9d8 100644
index 6adcd8d..20745df 100644
--- a/src/core/lib/transport/transport.cc
+++ b/src/core/lib/transport/transport.cc
@@ -96,6 +96,8 @@ void grpc_stream_ref_init(grpc_stream_refcount* refcount, int initial_refs,
@@ -97,6 +97,8 @@ void grpc_stream_ref_init(grpc_stream_refcount* refcount, int /*initial_refs*/,
refcount, &refcount->slice_refcount);
}

View File

@ -1,8 +1,8 @@
diff --git a/src/core/lib/slice/slice.cc b/src/core/lib/slice/slice.cc
index d3480abaa8..b3e63b2433 100644
index c0e2164..331e54c 100644
--- a/src/core/lib/slice/slice.cc
+++ b/src/core/lib/slice/slice.cc
@@ -226,6 +226,7 @@ grpc_slice grpc_slice_from_moved_buffer(grpc_core::UniquePtr<char> p,
@@ -214,6 +214,7 @@ grpc_slice grpc_slice_from_moved_buffer(grpc_core::UniquePtr<char> p,
size_t len) {
uint8_t* ptr = reinterpret_cast<uint8_t*>(p.get());
grpc_slice slice;

View File

@ -1,34 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a7fdb1fcd5..ae3bf61daf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4806,7 +4806,7 @@ if (gRPC_INSTALL)
endif()
-if (gRPC_BUILD_CODEGEN)
+if (gRPC_BUILD_CODEGEN AND NOT gRPC_USE_PROTO_LITE)
add_library(grpcpp_channelz
src/cpp/server/channelz/channelz_service.cc
src/cpp/server/channelz/channelz_service_plugin.cc
@@ -4865,7 +4865,7 @@ foreach(_hdr
endforeach()
-if (gRPC_BUILD_CODEGEN)
+if (gRPC_BUILD_CODEGEN AND NOT gRPC_USE_PROTO_LITE)
if (gRPC_INSTALL)
install(TARGETS grpcpp_channelz EXPORT gRPCTargets
@@ -4874,9 +4874,9 @@ if (gRPC_INSTALL)
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
)
endif()
-endif (gRPC_BUILD_CODEGEN)
+endif (gRPC_BUILD_CODEGEN AND NOT gRPC_USE_PROTO_LITE)
-endif (gRPC_BUILD_CODEGEN)
+endif (gRPC_BUILD_CODEGEN AND NOT gRPC_USE_PROTO_LITE)
if (gRPC_BUILD_TESTS)
if (gRPC_BUILD_CODEGEN)

View File

@ -1,5 +1,5 @@
Source: grpc
Version: 1.24.3
Version: 1.26.0
Build-Depends: zlib, openssl, protobuf, c-ares (!uwp)
Homepage: https://github.com/grpc/grpc
Description: An RPC library and framework

View File

@ -13,8 +13,8 @@ endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO grpc/grpc
REF v1.24.3
SHA512 19afa8b1fd64c429317c85d8cf42d01af0ac6aec82508740c176e1fd4f92dea9531ea9812523215ed67466bae93a75e14dc34cd9cce5987a13c0104e0313c69c
REF v1.26.0
SHA512 4f7d067c582d0a9be7b7d4dd1e08acdbe6ff0686dfe92b5db5b7927f779410a4237acfd1c61d9f79eb2d00f86cf93cc7492fa372c1877e57c1aa23e9bb2648bb
HEAD_REF master
PATCHES
00001-fix-uwp.patch
@ -23,7 +23,6 @@ vcpkg_from_github(
00004-link-gdi32-on-windows.patch
00005-fix-uwp-error.patch
00006-crypt32.patch
00007-disable_grpcpp_channelz.patch
00008-uwp_upb_disable_C4146_error.patch
)