From 927abdf8cdfb5c180b1f70c952076781d408bcb5 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sun, 4 Apr 2021 18:26:29 -0400 Subject: [PATCH] Integrate Sentry crash reporting --- .github/workflows/build.yml | 34 +++++++++++++++++++++------------- CMakeLists.txt | 17 +---------------- Editor/main.cpp | 6 ++++++ ci/build-appimage.sh | 4 ++-- hecl | 2 +- hecl-gui | 2 +- nod | 2 +- 7 files changed, 33 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 96d7c6900..26844241f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,7 +55,8 @@ jobs: working-directory: ${{github.workspace}}/build run: | cmake $GITHUB_WORKSPACE -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DCMAKE_C_COMPILER=${{matrix.cc}} -DCMAKE_CXX_COMPILER=${{matrix.cxx}} + -DCMAKE_C_COMPILER=${{matrix.cc}} -DCMAKE_CXX_COMPILER=${{matrix.cxx}} \ + -DSENTRY_DSN="${{secrets.SENTRY_DSN}}" - name: Build working-directory: ${{github.workspace}}/build @@ -92,7 +93,8 @@ jobs: working-directory: ${{github.workspace}}/build run: | export PATH="/usr/local/opt/qt@5/bin:$PATH" # FIXME remove - cmake $GITHUB_WORKSPACE -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo + cmake $GITHUB_WORKSPACE -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DSENTRY_DSN="${{secrets.SENTRY_DSN}}" - name: Build working-directory: ${{github.workspace}}/build @@ -109,7 +111,7 @@ jobs: working-directory: build/Binaries run: | mv hecl-gui.app URDE.app - for i in visigen hecl urde; do + for i in visigen hecl urde crashpad_handler; do codesign --timestamp --options runtime -s "${{secrets.MACOS_CODESIGN_IDENT}}" URDE.app/Contents/MacOS/$i done macdeployqt URDE.app -sign-for-notarization="${{secrets.MACOS_CODESIGN_IDENT}}" -no-strip @@ -169,25 +171,28 @@ jobs: -DCMAKE_TOOLCHAIN_FILE="$workspace/vcpkg-qt-$env:Qt_VERSION/scripts/buildsystems/vcpkg.cmake" ` -DVCPKG_TARGET_TRIPLET=x64-windows-static ` -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_CXX_FLAGS= -DCMAKE_C_FLAGS= ` - -DLLVM_ROOT_DIR="$workspace/LLVM" + -DLLVM_ROOT_DIR="$workspace/LLVM" ` + -DSENTRY_DSN="${{secrets.SENTRY_DSN}}" - name: Build working-directory: ${{github.workspace}}/build run: cmake --build . --config $BUILD_TYPE + - name: Compress PDBs + working-directory: ${{github.workspace}}/build/Binaries + run: 7z a -t7z debug.7z urde.pdb hecl.pdb hecl-gui.pdb visigen.pdb + - name: Upload artifacts uses: actions/upload-artifact@v2 with: name: urde-${{env.URDE_VERSION}}-win32-msvc-x86_64 path: | build/Binaries/urde.exe - build/Binaries/urde.pdb build/Binaries/hecl.exe - build/Binaries/hecl.pdb build/Binaries/hecl-gui.exe - build/Binaries/hecl-gui.pdb build/Binaries/visigen.exe - build/Binaries/visigen.pdb + build/Binaries/crashpad_handler.exe + build/Binaries/debug.7z build-windows-clang: name: Build Windows (Clang x86_64) @@ -237,22 +242,25 @@ jobs: -DCMAKE_C_COMPILER="$workspace/LLVM/bin/clang-cl.exe" ` -DCMAKE_CXX_COMPILER="$workspace/LLVM/bin/clang-cl.exe" ` -DCMAKE_LINKER="$workspace/LLVM/bin/lld-link.exe" ` - -DLLVM_ROOT_DIR="$workspace/LLVM" + -DLLVM_ROOT_DIR="$workspace/LLVM" ` + -DSENTRY_DSN="${{secrets.SENTRY_DSN}}" - name: Build working-directory: ${{github.workspace}}/build run: cmake --build . --config $BUILD_TYPE + - name: Compress PDBs + working-directory: ${{github.workspace}}/build/Binaries + run: 7z a -t7z debug.7z urde.pdb hecl.pdb hecl-gui.pdb visigen.pdb + - name: Upload artifacts uses: actions/upload-artifact@v2 with: name: urde-${{env.URDE_VERSION}}-win32-clang-x86_64 path: | build/Binaries/urde.exe - build/Binaries/urde.pdb build/Binaries/hecl.exe - build/Binaries/hecl.pdb build/Binaries/hecl-gui.exe - build/Binaries/hecl-gui.pdb build/Binaries/visigen.exe - build/Binaries/visigen.pdb + build/Binaries/crashpad_handler.exe + build/Binaries/debug.7z diff --git a/CMakeLists.txt b/CMakeLists.txt index a5dabcd11..b1f10f4d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,7 @@ if(DEFINED ENV{GITHUB_ENV}) file(APPEND "$ENV{GITHUB_ENV}" "URDE_VERSION=${URDE_WC_DESCRIBE}") endif() message(STATUS "URDE version set to ${URDE_WC_DESCRIBE}") -project(urde VERSION ${URDE_VERSION_STRING}) +project(urde LANGUAGES C CXX ASM VERSION ${URDE_VERSION_STRING}) if (APPLE) set(PLATFORM_NAME macos) @@ -70,21 +70,6 @@ endif () set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries) -if(APPLE) - # Shaddup Xcode - function(add_executable TARGET) - _add_executable(${TARGET} ${ARGN}) - set_target_properties(${TARGET} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "") - endfunction() - function(add_library TARGET) - _add_library(${TARGET} ${ARGN}) - list(GET ARGV 1 ARG1) - if(NOT ${ARG1} STREQUAL INTERFACE AND NOT ${ARG1} STREQUAL ALIAS) - set_target_properties(${TARGET} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "") - endif() - endfunction() -endif() - if(APPLE AND NOT CMAKE_OSX_SYSROOT) # If the Xcode SDK is lagging behind system version, CMake needs this done first execute_process(COMMAND xcrun --sdk macosx --show-sdk-path diff --git a/Editor/main.cpp b/Editor/main.cpp index 0cb96bef6..705ea5f15 100644 --- a/Editor/main.cpp +++ b/Editor/main.cpp @@ -142,6 +142,12 @@ static void SetupBasics(bool logging) { if (logging) logvisor::RegisterConsoleLogger(); atSetExceptionHandler(AthenaExc); + +#if SENTRY_ENABLED + hecl::Runtime::FileStoreManager fileMgr{_SYS_STR("sentry-native-urde")}; + hecl::SystemUTF8Conv cacheDir{fileMgr.getStoreRoot()}; + logvisor::RegisterSentry("urde", URDE_WC_DESCRIBE, cacheDir.c_str()); +#endif } static bool IsClientLoggingEnabled(int argc, const boo::SystemChar** argv) { diff --git a/ci/build-appimage.sh b/ci/build-appimage.sh index d7a192c40..5406118c9 100755 --- a/ci/build-appimage.sh +++ b/ci/build-appimage.sh @@ -7,8 +7,8 @@ chmod +x linuxdeploy-$(uname -m).AppImage linuxdeploy-plugin-qt-$(uname -m).AppI # Build AppImage mkdir -p appdir/usr/{bin,share/{applications,icons/hicolor}} -cp build/Binaries/{hecl,hecl-gui,urde,visigen} appdir/usr/bin -strip -s appdir/usr/bin/{hecl,hecl-gui,urde,visigen} +cp build/Binaries/{hecl,hecl-gui,urde,visigen,crashpad_handler} appdir/usr/bin +strip -s appdir/usr/bin/{hecl,hecl-gui,urde,visigen,crashpad_handler} cp -r Editor/platforms/freedesktop/{16x16,32x32,48x48,64x64,128x128,256x256,512x512,1024x1024} appdir/usr/share/icons/hicolor cp Editor/platforms/freedesktop/urde.desktop appdir/usr/share/applications sed -i 's/Exec=.*/Exec=hecl-gui/' appdir/usr/share/applications/urde.desktop diff --git a/hecl b/hecl index bccd20da1..3b544e688 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit bccd20da139253fd09feee787d647edc73339d50 +Subproject commit 3b544e688fb38ae824d4298c401a2efcb78cb55e diff --git a/hecl-gui b/hecl-gui index 22ed7c1dc..0237c1d21 160000 --- a/hecl-gui +++ b/hecl-gui @@ -1 +1 @@ -Subproject commit 22ed7c1dcd2a50ffaa9b863509237ba15e451f9c +Subproject commit 0237c1d21c045b985f6091ba7fed8f861a914003 diff --git a/nod b/nod index 364787604..11c734be4 160000 --- a/nod +++ b/nod @@ -1 +1 @@ -Subproject commit 364787604d0b976a6ffe345c4e7d6e2acc98d4e2 +Subproject commit 11c734be47b845b0d26bada9af7efe6faf60841d