Skip to content

Commit

Permalink
[sentry-native] update to 0.7.1 (#37620)
Browse files Browse the repository at this point in the history
  • Loading branch information
AenBleidd authored Mar 27, 2024
1 parent d0b3e8e commit 3c76dc5
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 6 deletions.
77 changes: 77 additions & 0 deletions ports/sentry-native/fix-crashpad-wer.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2e8ffcd..81907b8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -423,7 +423,7 @@ if(SENTRY_BACKEND_CRASHPAD)
endif()
add_subdirectory(external/crashpad crashpad_build)

- if(WIN32)
+ if(WIN32 AND SENTRY_TRANSPORT_CRASHPAD_USE_WER)
add_dependencies(sentry crashpad::wer)
endif()

@@ -438,7 +438,9 @@ if(SENTRY_BACKEND_CRASHPAD)
set_property(TARGET crashpad_snapshot PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set_property(TARGET crashpad_tools PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set_property(TARGET crashpad_util PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+if(SENTRY_TRANSPORT_CRASHPAD_USE_WER)
set_property(TARGET crashpad_wer PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+endif()
set_property(TARGET crashpad_zlib PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set_property(TARGET mini_chromium PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
@@ -455,7 +457,9 @@ if(SENTRY_BACKEND_CRASHPAD)
set_target_properties(crashpad_util PROPERTIES FOLDER ${SENTRY_FOLDER})
set_target_properties(crashpad_zlib PROPERTIES FOLDER ${SENTRY_FOLDER})
set_target_properties(mini_chromium PROPERTIES FOLDER ${SENTRY_FOLDER})
+if(SENTRY_TRANSPORT_CRASHPAD_USE_WER)
set_target_properties(crashpad_wer PROPERTIES FOLDER ${SENTRY_FOLDER})
+endif()
endif()

target_link_libraries(sentry PRIVATE
@@ -465,7 +469,7 @@ if(SENTRY_BACKEND_CRASHPAD)
install(EXPORT crashpad_export NAMESPACE sentry_crashpad:: FILE sentry_crashpad-targets.cmake
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
)
- if(WIN32 AND MSVC)
+ if(WIN32 AND MSVC AND SENTRY_TRANSPORT_CRASHPAD_USE_WER)
sentry_install(FILES $<TARGET_PDB_FILE:crashpad_handler>
DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL)
sentry_install(FILES $<TARGET_PDB_FILE:crashpad_wer>
diff --git a/external/crashpad/handler/CMakeLists.txt b/external/crashpad/handler/CMakeLists.txt
index 55d2e4a..b1c99ae 100644
--- a/external/crashpad/handler/CMakeLists.txt
+++ b/external/crashpad/handler/CMakeLists.txt
@@ -123,7 +123,7 @@ if(NOT IOS)
)
endif()

-if (WIN32)
+if (WIN32 AND SENTRY_TRANSPORT_CRASHPAD_USE_WER)
add_library(crashpad_wer SHARED
win/wer/crashpad_wer.cc
win/wer/crashpad_wer.h
diff --git a/src/backends/sentry_backend_crashpad.cpp b/src/backends/sentry_backend_crashpad.cpp
index 711dc57..4c1d473 100644
--- a/src/backends/sentry_backend_crashpad.cpp
+++ b/src/backends/sentry_backend_crashpad.cpp
@@ -115,7 +115,7 @@ crashpad_backend_user_consent_changed(sentry_backend_t *backend)
data->db->GetSettings()->SetUploadsEnabled(!sentry__should_skip_upload());
}

-#ifdef SENTRY_PLATFORM_WINDOWS
+#if defined(SENTRY_PLATFORM_WINDOWS) && defined(SENTRY_TRANSPORT_CRASHPAD_USE_WER)
static void
crashpad_register_wer_module(
const sentry_path_t *absolute_handler_path, const crashpad_state_t *data)
@@ -413,7 +413,7 @@ crashpad_backend_startup(
return 1;
}

-#ifdef SENTRY_PLATFORM_WINDOWS
+#if defined(SENTRY_PLATFORM_WINDOWS) && defined(SENTRY_TRANSPORT_CRASHPAD_USE_WER)
crashpad_register_wer_module(absolute_handler_path, data);
#endif

10 changes: 9 additions & 1 deletion ports/sentry-native/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/getsentry/sentry-native/releases/download/${VERSION}/sentry-native.zip"
FILENAME "sentry-native-${VERSION}.zip"
SHA512 745e2a4590df5412ab62ec6bb32efa7674423d4f0466f4ead9d327d6b0f9308ee8ae328b4beac00b31b34cf88d1dc0a102e81363b4a4a0395e98fcb0758c0551
SHA512 bf6d9aef8129d9ad9b1617e03bf7ac5e4ac5572ac87546f9428a359c4fc3364d2591cc001e7a28f50509d5cfddab9a17da2d4a33e344280fd490c8fe5173f2c7
)

vcpkg_extract_source_archive(
Expand All @@ -10,13 +10,16 @@ vcpkg_extract_source_archive(
NO_REMOVE_ONE_LEVEL
PATCHES
fix-config-cmake.patch
fix-crashpad-wer.patch
)
file(REMOVE_RECURSE "${SOURCE_PATH}/external/crashpad/third_party/zlib/zlib")

vcpkg_list(SET options)

if(NOT "backend" IN_LIST FEATURES)
vcpkg_list(APPEND options "-DSENTRY_BACKEND=none")
elseif("wer" IN_LIST FEATURES)
vcpkg_list(APPEND options "-DSENTRY_BACKEND=crashpad")
elseif(DEFINED SENTRY_BACKEND)
# Legacy, possible override from triplet, but cannot handle dependencies
vcpkg_list(APPEND options "-DSENTRY_BACKEND=${SENTRY_BACKEND}")
Expand All @@ -26,6 +29,10 @@ if(NOT "transport" IN_LIST FEATURES)
vcpkg_list(APPEND options "-DSENTRY_TRANSPORT=none")
endif()

if("wer" IN_LIST FEATURES)
vcpkg_list(APPEND options "-DSENTRY_TRANSPORT_CRASHPAD_USE_WER=ON")
endif()

if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
set(VCPKG_CXX_FLAGS "/D_CRT_DECLARE_NONSTDC_NAMES ${VCPKG_CXX_FLAGS}")
set(VCPKG_C_FLAGS "/D_CRT_DECLARE_NONSTDC_NAMES ${VCPKG_C_FLAGS}")
Expand Down Expand Up @@ -55,3 +62,4 @@ if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/crashpad_handler${VCPKG_TARGET_EXECUTABLE
endif()

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
4 changes: 4 additions & 0 deletions ports/sentry-native/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sentry-native provides CMake targets:

find_package(sentry CONFIG REQUIRED)
target_link_libraries(main PRIVATE sentry::sentry)
24 changes: 21 additions & 3 deletions ports/sentry-native/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "sentry-native",
"version": "0.7.0",
"port-version": 1,
"version": "0.7.1",
"description": "Sentry SDK for C, C++ and native applications.",
"homepage": "https://sentry.io/",
"license": "MIT",
Expand All @@ -18,7 +17,11 @@
],
"default-features": [
"backend",
"transport"
"transport",
{
"name": "wer",
"platform": "windows & !static"
}
],
"features": {
"backend": {
Expand Down Expand Up @@ -54,6 +57,21 @@
"platform": "!windows"
}
]
},
"wer": {
"description": [
"Enables the Windows Error Reporting backend.",
"Cf.https://github.com/getsentry/sentry-native#compile-time-options"
],
"supports": "windows & !static",
"dependencies": [
{
"name": "sentry-native",
"features": [
"backend"
]
}
]
}
}
}
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -7961,8 +7961,8 @@
"port-version": 1
},
"sentry-native": {
"baseline": "0.7.0",
"port-version": 1
"baseline": "0.7.1",
"port-version": 0
},
"septag-dmon": {
"baseline": "2022-02-08",
Expand Down
5 changes: 5 additions & 0 deletions versions/s-/sentry-native.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "573e6eab33f6c6e86bf574966809aba512874371",
"version": "0.7.1",
"port-version": 0
},
{
"git-tree": "3b95acbd27868522d2e27abe48d9f108d439f523",
"version": "0.7.0",
Expand Down

0 comments on commit 3c76dc5

Please sign in to comment.