From c0125ff8e8e5a7d4873a39ef9edccfec231188c4 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Mon, 8 Jun 2026 17:58:57 +0200 Subject: [PATCH 1/4] give option to run native as backend --- .github/workflows/build.yml | 8 +- .github/workflows/ci.yml | 6 +- .github/workflows/sdk.yml | 20 +++- .github/workflows/test-build-linux.yml | 32 ++++++- .github/workflows/test-run-desktop.yml | 2 +- .gitignore | 4 + build/native-sdks.targets | 52 +++++++++- package-dev/Plugins/Linux/Sentry.meta | 8 -- .../Linux/Sentry/libsentry.dbg.so.meta | 81 ---------------- .../Plugins/Linux/Sentry/libsentry.so.meta | 81 ---------------- scripts/download-native-sdks.ps1 | 9 +- .../ConfigurationWindow/AdvancedTab.cs | 11 +++ .../Native/BuildPostProcess.cs | 94 ++++++++++++++++++- .../ExperimentalSentryUnityOptions.cs | 10 ++ src/Sentry.Unity/LinuxBackend.cs | 17 ++++ .../ScriptableSentryUnityOptions.cs | 8 +- .../IntegrationOptionsConfiguration.cs | 1 + .../package-release.zip.snapshot | 12 ++- .../ScriptableSentryUnityOptionsTests.cs | 19 ++++ .../SentryUnityOptionsTests.cs | 15 +++ 20 files changed, 297 insertions(+), 193 deletions(-) delete mode 100644 package-dev/Plugins/Linux/Sentry.meta delete mode 100644 package-dev/Plugins/Linux/Sentry/libsentry.dbg.so.meta delete mode 100644 package-dev/Plugins/Linux/Sentry/libsentry.so.meta create mode 100644 src/Sentry.Unity/LinuxBackend.cs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 37e6f050e..62b4f6e2d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -102,7 +102,13 @@ jobs: uses: ./.github/actions/wait-for-artifact with: name: Linux-sdk - path: package-dev/Plugins/Linux + path: package-dev/Plugins/Linux/Sentry~ + + - name: Download LinuxNative SDK + uses: ./.github/actions/wait-for-artifact + with: + name: LinuxNative-sdk + path: package-dev/Plugins/Linux/SentryNative~ - name: Download Windows SDK uses: ./.github/actions/wait-for-artifact diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4bd03e777..15e9950e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,6 +40,8 @@ jobs: host: ubuntu-latest - target: Linux host: ubuntu-latest + - target: LinuxNative + host: ubuntu-latest - target: Windows host: windows-latest - target: WindowsNative @@ -401,7 +403,7 @@ jobs: unity-version: ${{ matrix.unity-version }} test-run-linux: - name: Run Linux ${{ matrix.unity-version }} Integration Test + name: Run Linux ${{ matrix.backend }} ${{ matrix.unity-version }} Integration Test if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} needs: [test-build-linux, create-unity-matrix] secrets: inherit @@ -409,10 +411,12 @@ jobs: fail-fast: false matrix: unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }} + backend: ["breakpad", "native"] uses: ./.github/workflows/test-run-desktop.yml with: unity-version: ${{ matrix.unity-version }} platform: linux + backend: ${{ matrix.backend }} test-run-windows: name: Run Windows ${{ matrix.backend }} ${{ matrix.unity-version }} Integration Test diff --git a/.github/workflows/sdk.yml b/.github/workflows/sdk.yml index 8b63bd7a9..4af4e2162 100644 --- a/.github/workflows/sdk.yml +++ b/.github/workflows/sdk.yml @@ -66,7 +66,7 @@ jobs: key: sdk=${{ env.TARGET }}-${{ hashFiles('submodules-status', 'package/package.json', 'Directory.Build.targets', 'build/native-sdks.targets', 'sdk-static/**', 'scripts/build-cocoa-sdk.ps1', 'scripts/build-native-ndk-local.ps1') }} - name: Installing Linux Dependencies - if: ${{ env.TARGET == 'Linux' && steps.cache.outputs.cache-hit != 'true' }} + if: ${{ (env.TARGET == 'Linux' || env.TARGET == 'LinuxNative') && steps.cache.outputs.cache-hit != 'true' }} shell: bash run: | sudo apt-get update @@ -136,7 +136,23 @@ jobs: retention-days: 14 - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - if: ${{ env.TARGET != 'Cocoa' && env.TARGET != 'MacOSNative' && env.TARGET != 'Windows' && env.TARGET != 'WindowsNative' }} + if: ${{ env.TARGET == 'Linux' }} + with: + name: ${{ env.TARGET }}-sdk + path: package-dev/Plugins/Linux/Sentry~ + # Lower retention period - we only need this to retry CI. + retention-days: 14 + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + if: ${{ env.TARGET == 'LinuxNative' }} + with: + name: ${{ env.TARGET }}-sdk + path: package-dev/Plugins/Linux/SentryNative~ + # Lower retention period - we only need this to retry CI. + retention-days: 14 + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + if: ${{ env.TARGET != 'Cocoa' && env.TARGET != 'MacOSNative' && env.TARGET != 'Windows' && env.TARGET != 'WindowsNative' && env.TARGET != 'Linux' && env.TARGET != 'LinuxNative' }} with: name: ${{ env.TARGET }}-sdk path: package-dev/Plugins/${{ env.TARGET }} diff --git a/.github/workflows/test-build-linux.yml b/.github/workflows/test-build-linux.yml index 2ceef6cd1..6a674d855 100644 --- a/.github/workflows/test-build-linux.yml +++ b/.github/workflows/test-build-linux.yml @@ -92,7 +92,7 @@ jobs: env: SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }} - - name: Build with Sentry SDK + - name: Build with Sentry SDK (Breakpad backend) run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux -UnityVersion "$env:UNITY_VERSION" - name: Compare build sizes @@ -106,15 +106,39 @@ jobs: retention-days: 1 # We create tar explicitly because upload-artifact is slow for many files. - - name: Create archive + - name: Create archive (Breakpad backend) run: | Remove-Item -Recurse -Force samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame -ErrorAction SilentlyContinue tar -cvzf test-app-desktop.tar.gz samples/IntegrationTest/Build - - name: Upload test app + - name: Upload test app (Breakpad backend) uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: testapp-desktop-compiled-${{ env.UNITY_VERSION }}-linux + name: testapp-desktop-compiled-${{ env.UNITY_VERSION }}-linux-breakpad + if-no-files-found: error + path: test-app-desktop.tar.gz + retention-days: 14 + + - name: Overwrite IntegrationOptionsConfiguration for Native backend + run: | + $optionsPath = "samples/IntegrationTest/Assets/Scripts/IntegrationOptionsConfiguration.cs" + $content = Get-Content $optionsPath -Raw + $content = $content -replace 'LinuxBackend = LinuxBackend.Breakpad', 'LinuxBackend = LinuxBackend.Native' + Set-Content $optionsPath $content + + - name: Build with Sentry SDK (Native backend) + run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux -UnityVersion "$env:UNITY_VERSION" + + - name: Create archive (Native backend) + run: | + Remove-Item -Recurse -Force samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame -ErrorAction SilentlyContinue + Remove-Item -Force test-app-desktop.tar.gz -ErrorAction SilentlyContinue + tar -cvzf test-app-desktop.tar.gz samples/IntegrationTest/Build + + - name: Upload test app (Native backend) + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: testapp-desktop-compiled-${{ env.UNITY_VERSION }}-linux-native if-no-files-found: error path: test-app-desktop.tar.gz retention-days: 14 diff --git a/.github/workflows/test-run-desktop.yml b/.github/workflows/test-run-desktop.yml index 816324042..881c8b532 100644 --- a/.github/workflows/test-run-desktop.yml +++ b/.github/workflows/test-run-desktop.yml @@ -13,7 +13,7 @@ on: required: false type: string default: "" - description: "macOS: native or cocoa. Windows: native or crashpad." + description: "macOS: native or cocoa. Windows: native or crashpad. Linux: native or breakpad." defaults: run: diff --git a/.gitignore b/.gitignore index 4eaaead10..24425332f 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,10 @@ package-dev/Plugins/Android/Sentry~/* package-dev/Plugins/Windows/Sentry~/* package-dev/Plugins/Windows/SentryNative~/* +# Linux SDK files +package-dev/Plugins/Linux/Sentry~/* +package-dev/Plugins/Linux/SentryNative~/* + # CLI package-dev/Editor/sentry-cli diff --git a/build/native-sdks.targets b/build/native-sdks.targets index dcdf9ba69..237587ae3 100644 --- a/build/native-sdks.targets +++ b/build/native-sdks.targets @@ -14,7 +14,8 @@ $(RepoRoot)modules/sentry-native/ - $(SentryArtifactsDestination)Linux/Sentry/ + $(SentryArtifactsDestination)Linux/Sentry~/ + $(SentryArtifactsDestination)Linux/SentryNative~/ $(SentryArtifactsDestination)Windows/Sentry~/ $(SentryArtifactsDestination)Windows/SentryNative~/ @@ -90,6 +91,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +