Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -401,18 +403,20 @@ 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
strategy:
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
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down
32 changes: 28 additions & 4 deletions .github/workflows/test-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-run-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Features

- Extend the experimental `sentry-native` backend to Linux. Opt in via `options.Experimental.LinuxBackend = LinuxBackend.Native`. The `sentry-native` backend uploads crashes immediately through an out-of-process handler and enables further updates such as `AppHangTracking` support ([#2708](https://github.com/getsentry/sentry-unity/pull/2708))

## 4.4.0

### Features
Expand Down
52 changes: 51 additions & 1 deletion build/native-sdks.targets
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

<!-- Native (Windows / Linux) -->
<SentryNativeRoot>$(RepoRoot)modules/sentry-native/</SentryNativeRoot>
<SentryLinuxArtifactsDestination>$(SentryArtifactsDestination)Linux/Sentry/</SentryLinuxArtifactsDestination>
<SentryLinuxArtifactsDestination>$(SentryArtifactsDestination)Linux/Sentry~/</SentryLinuxArtifactsDestination>
<SentryLinuxNativeArtifactsDestination>$(SentryArtifactsDestination)Linux/SentryNative~/</SentryLinuxNativeArtifactsDestination>
<SentryWindowsArtifactsDestination>$(SentryArtifactsDestination)Windows/Sentry~/</SentryWindowsArtifactsDestination>
<SentryWindowsNativeArtifactsDestination>$(SentryArtifactsDestination)Windows/SentryNative~/</SentryWindowsNativeArtifactsDestination>
</PropertyGroup>
Expand Down Expand Up @@ -90,6 +91,55 @@
<CallTarget Targets="BuildLinuxSDK" />
</Target>

<!--
Build the Sentry Native SDK for Linux (sentry-native's new native backend):
dotnet msbuild /t:BuildLinuxNativeSDK src/Sentry.Unity
Always wipes prior outputs and rebuilds. Produces libsentry.so and the
out-of-process sentry-crash daemon, plus stripped debug sidecars
(libsentry.dbg.so / sentry-crash.dbg) for symbol upload.
-->
<Target Name="BuildLinuxNativeSDK" Condition="'$(MSBuildProjectName)' == 'Sentry.Unity'">
<Error Condition="!$([MSBuild]::IsOSPlatform('Linux'))" Text="BuildLinuxNativeSDK can only run on Linux." />
<Error Condition="!Exists('$(SentryNativeRoot)')" Text="sentry-native submodule not checked out at $(SentryNativeRoot). Run: git submodule update --init modules/sentry-native" />

<Message Importance="High" Text="Building Sentry Native SDK for Linux (native backend, clean rebuild)." />

<!-- Wipe prior outputs -->
<RemoveDir Directories="$(SentryNativeRoot)build_native" ContinueOnError="true" />
<Delete Files="$(SentryLinuxNativeArtifactsDestination)libsentry.so" ContinueOnError="true" />
<Delete Files="$(SentryLinuxNativeArtifactsDestination)libsentry.dbg.so" ContinueOnError="true" />
<Delete Files="$(SentryLinuxNativeArtifactsDestination)sentry-crash" ContinueOnError="true" />
<Delete Files="$(SentryLinuxNativeArtifactsDestination)sentry-crash.dbg" ContinueOnError="true" />

<Exec WorkingDirectory="$(SentryNativeRoot)" Command="cmake -B build_native -D SENTRY_BACKEND=native -D SENTRY_SDK_NAME=sentry.native.unity -D CMAKE_BUILD_TYPE=RelWithDebInfo -S ." />
<Exec WorkingDirectory="$(SentryNativeRoot)" Command="cmake --build build_native --target sentry --parallel" />
<Exec WorkingDirectory="$(SentryNativeRoot)" Command="cmake --build build_native --target sentry-crash --parallel" />

<MakeDir Directories="$(SentryLinuxNativeArtifactsDestination)" />

<!-- strip all, including exported symbols except those starting with 'sentry_', except for 'sentry__' -->
<Exec WorkingDirectory="$(SentryNativeRoot)" Command="strip -s build_native/libsentry.so -w -K sentry_[^_]* -o $(SentryLinuxNativeArtifactsDestination)libsentry.so" />
<Copy SourceFiles="$(SentryNativeRoot)build_native/libsentry.so" DestinationFiles="$(SentryLinuxNativeArtifactsDestination)libsentry.dbg.so" />
<Exec WorkingDirectory="$(SentryLinuxNativeArtifactsDestination)" Command="objcopy --add-gnu-debuglink=libsentry.dbg.so libsentry.so" />

<!-- The crash daemon ships next to the player executable; keep an unstripped debug sidecar for symbol upload -->
<Copy SourceFiles="$(SentryNativeRoot)build_native/sentry-crash" DestinationFiles="$(SentryLinuxNativeArtifactsDestination)sentry-crash.dbg" />
<Exec WorkingDirectory="$(SentryNativeRoot)" Command="strip -s build_native/sentry-crash -o $(SentryLinuxNativeArtifactsDestination)sentry-crash" />
<Exec WorkingDirectory="$(SentryLinuxNativeArtifactsDestination)" Command="objcopy --add-gnu-debuglink=sentry-crash.dbg sentry-crash" />

<Error Condition="!Exists('$(SentryLinuxNativeArtifactsDestination)libsentry.so')" Text="Failed to set up the Linux Native SDK." />
<Error Condition="!Exists('$(SentryLinuxNativeArtifactsDestination)sentry-crash')" Text="Failed to set up the Linux Native SDK crash daemon." />
</Target>

<!-- Hooks into 'dotnet build' so a missing Linux Native plugin auto-triggers BuildLinuxNativeSDK. -->
<Target Name="EnsureLinuxNativeSDK"
BeforeTargets="BeforeBuild"
Condition="'$(MSBuildProjectName)' == 'Sentry.Unity'
And $([MSBuild]::IsOSPlatform('Linux'))
And !Exists('$(SentryLinuxNativeArtifactsDestination)libsentry.so')">
<CallTarget Targets="BuildLinuxNativeSDK" />
</Target>
Comment thread
bitsandfoxes marked this conversation as resolved.

<!--
Build the Sentry Native SDK for Windows:
dotnet msbuild /t:BuildWindowsSDK src/Sentry.Unity
Expand Down
8 changes: 0 additions & 8 deletions package-dev/Plugins/Linux/Sentry.meta

This file was deleted.

81 changes: 0 additions & 81 deletions package-dev/Plugins/Linux/Sentry/libsentry.dbg.so.meta

This file was deleted.

Loading
Loading