From cee546cfe059c0441dbbb02caa9cfba07600d42b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gro=C3=9F?= Date: Sat, 31 May 2025 14:10:24 +0200 Subject: [PATCH] Replace CMAKE_BACKTRACE_URL and CMAKE_BACKTRACE_TOKEN environment variables with OVERTE_BACKTRACE_URL and OVERTE_BACKTRACE_TOKEN CMake cache variables. --- .github/workflows/linux_server_build.yml | 10 ---------- .github/workflows/master_build.yml | 3 --- .github/workflows/pr_build.yml | 5 ----- .github/workflows/release_build.yml | 3 --- BUILD.md | 14 +++++++++----- CMakeLists.txt | 2 ++ cmake/macros/AddCrashpad.cmake | 17 +++++++---------- .../networking/src/crash-handler/CrashHandler.h | 12 ++++++------ .../CrashHandlerBackend_Crashpad.cpp | 5 +++-- 9 files changed, 27 insertions(+), 44 deletions(-) diff --git a/.github/workflows/linux_server_build.yml b/.github/workflows/linux_server_build.yml index d4e6c4ab7a..3217714683 100644 --- a/.github/workflows/linux_server_build.yml +++ b/.github/workflows/linux_server_build.yml @@ -207,16 +207,6 @@ jobs: echo "BUILD_NUMBER=$GIT_COMMIT_SHORT" >> $GITHUB_ENV - # Disabled until we build with Crashpad again. - #~ if [ "${{ github.ref_type }}" == "tag" ]; then - #~ export CMAKE_BACKTRACE_URL="${{ secrets.SENTRY_MINIDUMP_ENDPOINT }}" - #~ export CMAKE_BACKTRACE_TOKEN="${{ github.ref_name }}_${{ matrix.os }}_${{ github.sha }}" - #~ else - #~ # We're building a PR, default to the PR endpoint - #~ export CMAKE_BACKTRACE_URL="https://o4504831972343808.ingest.sentry.io/api/4504832427950080/minidump/?sentry_key=f511de295975461b8f92a36f4a4a4f32" - #~ export CMAKE_BACKTRACE_TOKEN="server_pr_${{ github.event.number }}_${{ github.sha }}" - #~ fi - - name: Configure Build Environment 3 shell: bash run: | diff --git a/.github/workflows/master_build.yml b/.github/workflows/master_build.yml index af18b560f9..c79271a5c8 100644 --- a/.github/workflows/master_build.yml +++ b/.github/workflows/master_build.yml @@ -21,9 +21,6 @@ env: UPLOAD_BUCKET: overte-public UPLOAD_REGION: fra1 UPLOAD_ENDPOINT: "https://fra1.digitaloceanspaces.com" - # Disabled until we build with Crashpad again. - # CMAKE_BACKTRACE_URL: ${{ secrets.SENTRY_MINIDUMP_ENDPOINT }} - # CMAKE_BACKTRACE_TOKEN: master_${{ github.event.number }}_${{ github.sha }} # OSX-specific variables DEVELOPER_DIR: /Applications/Xcode_11.2.app/Contents/Developer diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index 96bd88ba1a..9a8b87e200 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -17,11 +17,6 @@ env: RELEASE_TYPE: PR RELEASE_NUMBER: ${{ github.event.number }} VERSION_CODE: ${{ github.event.number }} - # Sentry Crash Reporting - # We can't use secrets or actions here, so the actual value has to be hardcoded. - # Disabled until we build with Crashpad again. - # CMAKE_BACKTRACE_URL: "https://o4504831972343808.ingest.sentry.io/api/4504832427950080/minidump/?sentry_key=f511de295975461b8f92a36f4a4a4f32" - # CMAKE_BACKTRACE_TOKEN: PR_${{ github.event.number }}_${{ github.sha }} UPLOAD_BUCKET: overte-public UPLOAD_REGION: fra1 diff --git a/.github/workflows/release_build.yml b/.github/workflows/release_build.yml index b42a5c3530..7b780fa5e9 100644 --- a/.github/workflows/release_build.yml +++ b/.github/workflows/release_build.yml @@ -23,9 +23,6 @@ env: UPLOAD_BUCKET: overte-public UPLOAD_REGION: fra1 UPLOAD_ENDPOINT: "https://fra1.digitaloceanspaces.com" - # Disabled until we build with Crashpad again. - # CMAKE_BACKTRACE_URL: ${{ secrets.SENTRY_MINIDUMP_ENDPOINT }} - # CMAKE_BACKTRACE_TOKEN: ${{ github.ref_name }}_Windows_${{ github.sha }} # WIN-specific variables PreferredToolArchitecture: X64 diff --git a/BUILD.md b/BUILD.md index 76f41433ae..a6ebfb57ad 100644 --- a/BUILD.md +++ b/BUILD.md @@ -60,11 +60,6 @@ Where `/path/to/directory` is the path to a directory where you wish the build f #### Possible Environment Variables ```text -// The URL to post the dump to. -CMAKE_BACKTRACE_URL -// The identifying tag of the release. -CMAKE_BACKTRACE_TOKEN - // The release version, e.g., 2021.3.2. RELEASE_NUMBER // The build commit, e.g., use a Git hash for the most recent commit in the branch - fd6973b. @@ -93,6 +88,15 @@ USE_STABLE_GLOBAL_SERVICES=1 BUILD_GLOBAL_SERVICES=STABLE ``` +#### Possible CMake Variables + +```text +// The URL to post the dump to. +OVERTE_BACKTRACE_URL +// The identifying tag of the release. +OVERTE_BACKTRACE_TOKEN +``` + #### Generate Files ```bash diff --git a/CMakeLists.txt b/CMakeLists.txt index b5ffaf19cd..e9be2e59c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,6 +169,8 @@ set(BUILD_TOOLS_OPTION ON) set(BUILD_INSTALLER_OPTION ON) set(DISABLE_QML_OPTION OFF) set(DOWNLOAD_SERVERLESS_CONTENT_OPTION OFF) +set(OVERTE_BACKTRACE_URL "" CACHE STRING "URL to an endpoint for uploading crash-dumps. For example Sentry.") +set(OVERTE_BACKTRACE_TOKEN "" CACHE STRING "Token used to identify with release or build is uploading crash-dumps.") if (ANDROID OR UWP) set(BUILD_SERVER_OPTION OFF) diff --git a/cmake/macros/AddCrashpad.cmake b/cmake/macros/AddCrashpad.cmake index dfd4cc188c..2543c0b507 100644 --- a/cmake/macros/AddCrashpad.cmake +++ b/cmake/macros/AddCrashpad.cmake @@ -4,6 +4,7 @@ # # Created by Clement Brisset on 01/19/18. # Copyright 2018 High Fidelity, Inc. +# Copyright 2025 Overte e.V. # # Distributed under the Apache License, Version 2.0. # See the accompanying file LICENSE or http:#www.apache.org/licenses/LICENSE-2.0.html @@ -13,18 +14,14 @@ macro(add_crashpad) set (USE_CRASHPAD TRUE) message(STATUS "Checking crashpad config") - if ("$ENV{CMAKE_BACKTRACE_URL}" STREQUAL "") - message(STATUS "Checking crashpad config - CMAKE_BACKTRACE_URL is not set, disabled.") + if (OVERTE_BACKTRACE_URL STREQUAL "") + message(STATUS "Checking crashpad config - -DOVERTE_BACKTRACE_URL is empty, disabled.") set(USE_CRASHPAD FALSE) - else() - set(CMAKE_BACKTRACE_URL $ENV{CMAKE_BACKTRACE_URL}) endif() - if ("$ENV{CMAKE_BACKTRACE_TOKEN}" STREQUAL "") - message(STATUS "Checking crashpad config - CMAKE_BACKTRACE_TOKEN is not set, disabled.") + if (OVERTE_BACKTRACE_TOKEN STREQUAL "") + message(STATUS "Checking crashpad config - -DOVERTE_BACKTRACE_TOKEN is empty, disabled.") set(USE_CRASHPAD FALSE) - else() - set(CMAKE_BACKTRACE_TOKEN $ENV{CMAKE_BACKTRACE_TOKEN}) endif() if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") @@ -42,8 +39,8 @@ macro(add_crashpad) endif() add_definitions(-DHAS_CRASHPAD) - add_definitions(-DCMAKE_BACKTRACE_URL=\"${CMAKE_BACKTRACE_URL}\") - add_definitions(-DCMAKE_BACKTRACE_TOKEN=\"${CMAKE_BACKTRACE_TOKEN}\") + add_definitions(-DOVERTE_BACKTRACE_URL=\"${OVERTE_BACKTRACE_URL}\") + add_definitions(-DOVERTE_BACKTRACE_TOKEN=\"${OVERTE_BACKTRACE_TOKEN}\") target_include_directories(${TARGET_NAME} PRIVATE ${CRASHPAD_INCLUDE_DIRS}) target_link_libraries(${TARGET_NAME} ${CRASHPAD_LIBRARY} ${CRASHPAD_UTIL_LIBRARY} ${CRASHPAD_BASE_LIBRARY}) diff --git a/libraries/networking/src/crash-handler/CrashHandler.h b/libraries/networking/src/crash-handler/CrashHandler.h index d2e8a4b5b5..75213a4dd8 100644 --- a/libraries/networking/src/crash-handler/CrashHandler.h +++ b/libraries/networking/src/crash-handler/CrashHandler.h @@ -3,7 +3,7 @@ // // // Created by Dale Glass on 25/06/2023. -// Copyright 2023 Overte e.V. +// Copyright 2023-2025 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -103,7 +103,7 @@ public slots: * Reasons for it failing to start include: * * * Not having a crash reporter for the platform - * * Crash reporter not being configured with reporting URLs (CMAKE_BACKTRACE_TOKEN and CMAKE_BACKTRACE_URL) + * * Crash reporter not being configured with reporting URLs (OVERTE_BACKTRACE_TOKEN and OVERTE_BACKTRACE_URL) * * Crash reporter is present and configured, but failed to initialize for some reason * * @return true Crash reporter is present, configured and working. @@ -118,7 +118,7 @@ public slots: * This setting is independent of isCrashMonitorStarted() -- crash reporting may be enabled but fail to work * due to the crash reporting component being missing or failing to initialize. * - * @return true Crashes will be reported to CMAKE_BACKTRACE_URL + * @return true Crashes will be reported to OVERTE_BACKTRACE_URL * @return false Crashes will not be reported */ bool isEnabled() const { return _crashReportingEnabled; } @@ -126,7 +126,7 @@ public slots: /** * @brief Set whether we want to submit crash reports to the report server * - * The report server is configured with CMAKE_BACKTRACE_URL. + * The report server is configured with OVERTE_BACKTRACE_URL. * Emits crashReportingEnabledChanged signal. * * @note This automatically calls start(), so it should be called after setPath(), setUrl() and setToken() @@ -137,7 +137,7 @@ public slots: /** * @brief Set the URL where to send crash reports to * - * If not set, a predefined URL specified at compile time via CMAKE_BACKTRACE_URL + * If not set, a predefined URL specified at compile time via OVERTE_BACKTRACE_URL * will be used. * * @param url URL @@ -150,7 +150,7 @@ public slots: * This is an identifier in the crash collection service, such as Sentry, and may contain * a branch name or a version number. * - * If not set, a predefined token specified at compile time via CMAKE_BACKTRACE_TOKEN + * If not set, a predefined token specified at compile time via OVERTE_BACKTRACE_TOKEN * will be used. * * @param token Token diff --git a/libraries/networking/src/crash-handler/CrashHandlerBackend_Crashpad.cpp b/libraries/networking/src/crash-handler/CrashHandlerBackend_Crashpad.cpp index 70b0189f29..cf893f267b 100644 --- a/libraries/networking/src/crash-handler/CrashHandlerBackend_Crashpad.cpp +++ b/libraries/networking/src/crash-handler/CrashHandlerBackend_Crashpad.cpp @@ -4,6 +4,7 @@ // // Created by Clement Brisset on 01/19/18. // Copyright 2018 High Fidelity, Inc. +// Copyright 2025 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -47,8 +48,8 @@ Q_LOGGING_CATEGORY(crash_handler, "overte.crash_handler") -static const std::string BACKTRACE_URL{ CMAKE_BACKTRACE_URL }; -static const std::string BACKTRACE_TOKEN{ CMAKE_BACKTRACE_TOKEN }; +static const std::string BACKTRACE_URL{ OVERTE_BACKTRACE_URL }; +static const std::string BACKTRACE_TOKEN{ OVERTE_BACKTRACE_TOKEN }; std::string custom_backtrace_url; std::string custom_backtrace_token;