Skip to content

Commit

Permalink
[grpc] Update to 1.46.3 (#25071)
Browse files Browse the repository at this point in the history
* Update gRPC to 1.46.3 and upb to 2022-06-01

* fix(upb): Ensure that protoc-gen-upb has been build before running protobuf_generate. Also add license to vcpkg.json

* fix(upb): Let abseil propagate cxx_std_11. Build upb codegen tools in host triplet

* Revert abseil's cxx_std propagation

* fix(upb): Attempt to fix missing -std=c++11 flag when compiling x64-osx

* Downgrade upb to the version used by gRPC. No longer installed generated descriptor.upb.h files just to use them when compiling target triplet

* Remove absl-sync patch from gRPC since it is always enabled by default now

* Use vcpkg's upb library in gRPC instead of embedded one. Also fix gRPC's pkgconfig patch

* grpc: Remove the upb::all_libs target

* grpc: Adjust versions json

* upb: Adjust versions json

* Set feature absl-sync as deprecated

* version

Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
  • Loading branch information
Tradias and JackBoosY committed Jul 14, 2022
1 parent a480fb0 commit 0cb8191
Show file tree
Hide file tree
Showing 20 changed files with 271 additions and 251 deletions.
23 changes: 18 additions & 5 deletions ports/grpc/00005-fix-uwp-error.patch
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc
index cb17759bba..a3c3598430 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc
+++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc
@@ -1032,7 +1032,7 @@ class HPackParser::Parser {

private:
void GPR_ATTRIBUTE_NOINLINE LogHeader(const HPackTable::Memento& memento) {
- const char* type;
+ const char* type = nullptr;
switch (log_info_.type) {
case LogInfo::kHeaders:
type = "HDR";
diff --git a/src/core/lib/slice/slice.cc b/src/core/lib/slice/slice.cc
index 0dacbfef3e..0743a1b003 100644
index 2e78b4de9e..77e88cab70 100644
--- a/src/core/lib/slice/slice.cc
+++ b/src/core/lib/slice/slice.cc
@@ -234,6 +234,7 @@ grpc_slice grpc_slice_from_moved_buffer(grpc_core::UniquePtr<char> p,
@@ -181,6 +181,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;
+ memset(&slice, 0, sizeof(grpc_slice));
if (len <= sizeof(slice.data.inlined.bytes)) {
slice.refcount = nullptr;
slice.data.inlined.length = len;
@@ -253,7 +254,7 @@ grpc_slice grpc_slice_from_moved_string(grpc_core::UniquePtr<char> p) {
@@ -199,7 +200,7 @@ grpc_slice grpc_slice_from_moved_string(grpc_core::UniquePtr<char> p) {
}

grpc_slice grpc_slice_from_cpp_string(std::string str) {
Expand All @@ -20,10 +33,10 @@ index 0dacbfef3e..0743a1b003 100644
slice.refcount = nullptr;
slice.data.inlined.length = str.size();
diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc
index c94551545d..3fd9797316 100644
index 4c0220837e..bb5a367107 100644
--- a/src/core/lib/surface/server.cc
+++ b/src/core/lib/surface/server.cc
@@ -878,7 +878,7 @@ grpc_call_error Server::QueueRequestedCall(size_t cq_idx, RequestedCall* rc) {
@@ -902,7 +902,7 @@ grpc_call_error Server::QueueRequestedCall(size_t cq_idx, RequestedCall* rc) {
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Server Shutdown"));
return GRPC_CALL_OK;
}
Expand Down
13 changes: 0 additions & 13 deletions ports/grpc/00006-fix-uwp-error.patch

This file was deleted.

32 changes: 15 additions & 17 deletions ports/grpc/00009-use-system-upb.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c3146b..ae06ea3 100644
index a7e591f083..e16e70a224 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -84,6 +84,9 @@ set_property(CACHE gRPC_SSL_PROVIDER PROPERTY STRINGS "module" "package")
@@ -85,6 +85,9 @@ set_property(CACHE gRPC_SSL_PROVIDER PROPERTY STRINGS "module" "package")
set(gRPC_PROTOBUF_PROVIDER "module" CACHE STRING "Provider of protobuf library")
set_property(CACHE gRPC_PROTOBUF_PROVIDER PROPERTY STRINGS "module" "package")

Expand All @@ -12,33 +12,34 @@ index 1c3146b..ae06ea3 100644
set(gRPC_PROTOBUF_PACKAGE_TYPE "" CACHE STRING "Algorithm for searching protobuf package")
set_property(CACHE gRPC_PROTOBUF_PACKAGE_TYPE PROPERTY STRINGS "CONFIG" "MODULE")

@@ -1504,7 +1507,6 @@ target_link_libraries(gpr
@@ -1369,7 +1372,7 @@ target_link_libraries(gpr
absl::synchronization
absl::time
absl::optional
- upb
+ ${_gRPC_UPB_LIBRARIES}
)
if(_gRPC_PLATFORM_ANDROID)
target_link_libraries(gpr
@@ -3927,6 +3929,7 @@ endif()
@@ -3957,6 +3960,7 @@ endif()

endif()

+if (gRPC_UPB_PROVIDER STREQUAL "module")
add_library(upb
third_party/upb/upb/decode_fast.c
third_party/upb/upb/decode.c
@@ -3984,7 +3987,7 @@ if(gRPC_INSTALL)
third_party/upb/third_party/utf8_range/naive.c
third_party/upb/third_party/utf8_range/range2-neon.c
@@ -4018,7 +4022,7 @@ if(gRPC_INSTALL)
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
)
endif()

-
+endif()

add_executable(check_epollexclusive
test/build/check_epollexclusive.c

add_executable(gen_hpack_tables
diff --git a/cmake/gRPCConfig.cmake.in b/cmake/gRPCConfig.cmake.in
index 3623f4a..df6ced5 100644
index 3623f4aa5e..df6ced560e 100644
--- a/cmake/gRPCConfig.cmake.in
+++ b/cmake/gRPCConfig.cmake.in
@@ -8,6 +8,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules)
Expand All @@ -50,10 +51,10 @@ index 3623f4a..df6ced5 100644
# Targets
include(${CMAKE_CURRENT_LIST_DIR}/gRPCTargets.cmake)
diff --git a/cmake/upb.cmake b/cmake/upb.cmake
index f2a0e50..ac6d397 100644
index f2a0e508c3..09751f5ef0 100644
--- a/cmake/upb.cmake
+++ b/cmake/upb.cmake
@@ -12,9 +12,21 @@
@@ -12,9 +12,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.

Expand All @@ -67,12 +68,9 @@ index f2a0e50..ac6d397 100644

set(_gRPC_UPB_LIBRARIES upb)
+
+
+elseif(gRPC_UPB_PROVIDER STREQUAL "package")
+ find_package(upb CONFIG REQUIRED)
+ set(_gRPC_UPB_LIBRARIES upb::upb)
+ set(_gRPC_UPB_LIBRARIES upb::fastdecode upb::json upb::upb upb::utf8_range upb::textformat upb::reflection upb::descriptor_upb_proto)
+ set(_gRPC_UPB_INCLUDE_DIR)
+ set(upb ${_gRPC_UPB_LIBRARIES})
+ set(_gRPC_FIND_UPB "if(NOT upb_FOUND)\n find_package(upb CONFIG REQUIRED)\nendif()")
+endif()
\ No newline at end of file
33 changes: 0 additions & 33 deletions ports/grpc/00010-add-feature-absl-sync.patch

This file was deleted.

28 changes: 0 additions & 28 deletions ports/grpc/00013-build-upbdefs.patch

This file was deleted.

2 changes: 1 addition & 1 deletion ports/grpc/00014-pkgconfig-upbdefs.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ index 54b4b23..83fab3b 100644
"${gRPC_CORE_VERSION}"
"gpr openssl absl_base absl_bind_front absl_cord absl_core_headers absl_flat_hash_map absl_hash absl_inlined_vector absl_memory absl_optional absl_random_random absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_utility absl_variant"
- "-lgrpc -laddress_sorting -lre2 -lupb -lcares -lz"
+ "-lgrpc -lgrpc_upbdefs -laddress_sorting -lre2 -lupb_fastdecode -lupb_json -lupb_pb -lupb_handlers -lupb_textformat -lupb_reflection -lupb -lcares -lz"
+ "-lgrpc -laddress_sorting -lre2 -ldescriptor_upb_proto -lupb_fastdecode -lupb_json -lupb_reflection -lupb_textformat -lupb_utf8_range -lupb -lcares -lz"
""
"grpc.pc")

13 changes: 3 additions & 10 deletions ports/grpc/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,19 @@ endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO grpc/grpc
REF 591d56e1300b6d11948e1b821efac785a295989c # v1.44.0
SHA512 b24f82768eed95b017a499ffb539af1f59d6916ab2da5ffb1de344ea7b0b7df536d1bb29a9bcb273bd84bc1f11b62383dc6c7df62e50d57621228f5aeeca6d5d
REF v1.46.3
SHA512 e80322b65c6f8d64dc91bce9f612119191e8d329cac2fbc5da6dad9a2a7ccaa7a501470ed483e555c3ba596e8aff796fbda2747f09e9c4329aed3de4d9b6b666
HEAD_REF master
PATCHES
00001-fix-uwp.patch
00002-static-linking-in-linux.patch
00003-undef-base64-macro.patch
00004-link-gdi32-on-windows.patch
00005-fix-uwp-error.patch
00006-fix-uwp-error.patch
00009-use-system-upb.patch
00010-add-feature-absl-sync.patch
00011-fix-csharp_plugin.patch
snprintf.patch
00012-fix-use-cxx17.patch
00013-build-upbdefs.patch
00014-pkgconfig-upbdefs.patch
)

Expand All @@ -40,7 +37,6 @@ endif()
vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
absl-sync gRPC_ABSL_SYNC_ENABLE
codegen gRPC_BUILD_CODEGEN
)

Expand Down Expand Up @@ -90,11 +86,8 @@ else()
configure_file("${CMAKE_CURRENT_LIST_DIR}/gRPCTargets-vcpkg-tools.cmake" "${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets-vcpkg-tools.cmake" @ONLY)
endif()

# Ignore the C# extension DLL in bin/
SET(VCPKG_POLICY_EMPTY_PACKAGE enabled)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share" "${CURRENT_PACKAGES_DIR}/debug/include")

vcpkg_copy_pdbs()

file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
5 changes: 2 additions & 3 deletions ports/grpc/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "grpc",
"version-semver": "1.44.0",
"port-version": 1,
"version-semver": "1.46.3",
"description": "An RPC library and framework",
"homepage": "https://github.com/grpc/grpc",
"license": "Apache-2.0",
Expand Down Expand Up @@ -38,7 +37,7 @@
],
"features": {
"absl-sync": {
"description": "Use abseil synchronization module"
"description": "Deprecated."
},
"codegen": {
"description": "Build code generator machinery"
Expand Down
Loading

0 comments on commit 0cb8191

Please sign in to comment.