Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of two plugin versions for GitHub/Marketplace #387

Merged
merged 12 commits into from
Sep 21, 2023
Merged
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
27 changes: 21 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,30 @@ jobs:
# See discussion in https://github.com/getsentry/sentry-unreal/pull/173
runsOn: ubuntu-20.04

windows-sdk:
windows-crashpad-sdk:
uses: ./.github/workflows/sdk.yml
with:
target: Win64
target: Win64-Crashpad
runsOn: windows-latest

windows-breakpad-sdk:
uses: ./.github/workflows/sdk.yml
with:
target: Win64-Breakpad
runsOn: windows-latest

build:
needs: [android-sdk, ios-sdk, macos-sdk, linux-sdk, windows-sdk]
needs: [android-sdk, ios-sdk, macos-sdk, linux-sdk, windows-crashpad-sdk, windows-breakpad-sdk]
name: Package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Download CLI
shell: pwsh
run: ./scripts/download-cli.ps1

- uses: actions/download-artifact@v3
with:
name: Android-sdk
Expand Down Expand Up @@ -70,8 +80,13 @@ jobs:

- uses: actions/download-artifact@v3
with:
name: Win64-sdk
path: plugin-dev/Source/ThirdParty/Win64
name: Win64-Crashpad-sdk
path: plugin-dev/Source/ThirdParty/Win64/Crashpad

- uses: actions/download-artifact@v3
with:
name: Win64-Breakpad-sdk
path: plugin-dev/Source/ThirdParty/Win64/Breakpad

- name: Prepare Sentry packages for release
shell: pwsh
Expand Down Expand Up @@ -185,7 +200,7 @@ jobs:
path: checkout

- name: Extract package to ${{ matrix.app }}/Plugins
run: unzip sentry-unreal-*-engine${{ matrix.unreal }}.zip -d checkout/${{ matrix.app }}/Plugins/sentry
run: unzip sentry-unreal-*-engine${{ matrix.unreal }}-github.zip -d checkout/${{ matrix.app }}/Plugins/sentry

- name: Set permissions for ${{ matrix.app }}
# sentry-native requires write access to sample project directory in order to initialize itself properly
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ plugin-dev/Intermediate/*
.DS_Store

# Ignore package release
package-release/
package-release-github/
package-release-marketplace/
sentry-unreal-*.zip

# Prebuilt libraries & artifacts are collected in CI.
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Features

- Add symbol upload scripts downloading tool ([#385](https://github.com/getsentry/sentry-unreal/pull/385))
- Add support of two plugin versions for GitHub/Marketplace([#387](https://github.com/getsentry/sentry-unreal/pull/387))

### Fixes

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ changelog of every version.

[releases]: https://github.com/getsentry/sentry-unreal/releases

If manual download from the [Releases] page is a preferred way for plugin integration using the package with the `github` suffix in its name is recommended.

## Supported Platforms and Unreal Engine version

The SDK currently supports and is tested on the following platforms:
Expand All @@ -32,7 +34,7 @@ The SDK complies with three latest engine versions.

## Known Limitations

- On all platforms captured crashes are uploaded to Sentry only after relaunching the crashed app since the in-process breakpad handler cannot do this within the same session. The only exception is Linux for which the out-of-process crashpad handler is used and crashes are uploaded immediately.
- On all platforms captured crashes are uploaded to Sentry only after relaunching the crashed app since the in-process handler cannot do this within the same session. The only exceptions are Windows (if using the GitHub package) and Linux for which the out-of-process crashpad handler is used and crashes are uploaded immediately.

- To automatically capture crashes in Windows game builds that were made using engine versions prior to UE 5.2, the [Crash Reporter has to be configured](https://docs.sentry.io/platforms/unreal/setup-crashreport/) first.

Expand Down
29 changes: 19 additions & 10 deletions plugin-dev/Source/Sentry/Sentry.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,31 +87,39 @@ public Sentry(ReadOnlyTargetRules Target) : base(Target)
AdditionalPropertiesForReceipt.Add("AndroidPlugin", Path.Combine(PluginPath, "Sentry_Android_UPL.xml"));
}

// Additional routine for Desktop platforms
if (Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlatform.Mac || Target.Platform == UnrealTargetPlatform.Linux)
{
PublicIncludePaths.Add(Path.Combine(PlatformThirdPartyPath, "include"));
}

// Additional routine for Windows
if (Target.Platform == UnrealTargetPlatform.Win64)
{
bool CrashpadExists = File.Exists(Path.Combine(PlatformThirdPartyPath, "Crashpad", "bin", "crashpad_handler.exe"));

string WindowsThirdPartyPath = Path.Combine(PlatformThirdPartyPath, CrashpadExists ? "Crashpad" : "Breakpad");

PublicIncludePaths.Add(Path.Combine(WindowsThirdPartyPath, "include"));
PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Private", "Desktop"));

RuntimeDependencies.Add(Path.Combine(PlatformBinariesPath, "sentry.dll"), Path.Combine(PlatformThirdPartyPath, "bin", "sentry.dll"));
RuntimeDependencies.Add(Path.Combine(PlatformBinariesPath, "sentry.pdb"), Path.Combine(PlatformThirdPartyPath, "bin", "sentry.pdb"));
RuntimeDependencies.Add(Path.Combine(PlatformBinariesPath, "sentry.dll"), Path.Combine(WindowsThirdPartyPath, "bin", "sentry.dll"));
RuntimeDependencies.Add(Path.Combine(PlatformBinariesPath, "sentry.pdb"), Path.Combine(WindowsThirdPartyPath, "bin", "sentry.pdb"));

PublicDelayLoadDLLs.Add("sentry.dll");

PublicAdditionalLibraries.Add(Path.Combine(PlatformThirdPartyPath, "lib", "sentry.lib"));
PublicAdditionalLibraries.Add(Path.Combine(PlatformThirdPartyPath, "lib", "breakpad_client.lib"));
PublicAdditionalLibraries.Add(Path.Combine(WindowsThirdPartyPath, "lib", "sentry.lib"));

if (CrashpadExists)
{
RuntimeDependencies.Add(Path.Combine(PlatformBinariesPath, "crashpad_handler.exe"), Path.Combine(WindowsThirdPartyPath, "bin", "crashpad_handler.exe"));
}
else
{
PublicAdditionalLibraries.Add(Path.Combine(WindowsThirdPartyPath, "lib", "breakpad_client.lib"));
}

PublicDefinitions.Add("USE_SENTRY_NATIVE=1");
}

// Additional routine for Linux
if (Target.Platform == UnrealTargetPlatform.Linux)
{
PublicIncludePaths.Add(Path.Combine(PlatformThirdPartyPath, "include"));
PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Private", "Desktop"));

RuntimeDependencies.Add(Path.Combine(PlatformBinariesPath, "libsentry.so"), Path.Combine(PlatformThirdPartyPath, "bin", "libsentry.so"));
Expand All @@ -127,6 +135,7 @@ public Sentry(ReadOnlyTargetRules Target) : base(Target)
// Additional routine for Mac
if (Target.Platform == UnrealTargetPlatform.Mac)
{
PublicIncludePaths.Add(Path.Combine(PlatformThirdPartyPath, "include"));
PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Private", "Apple"));

RuntimeDependencies.Add(Path.Combine(PlatformBinariesPath, "sentry.dylib"), Path.Combine(PlatformThirdPartyPath, "bin", "sentry.dylib"));
Expand Down
File renamed without changes.
21 changes: 21 additions & 0 deletions scripts/build-win64-crashpad.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -euo pipefail

export sentryNativeRoot=$1
export sentryArtifactsDestination=$2

rm -rf "${sentryArtifactsDestination}/"*

cmake -S "${sentryNativeRoot}" -B "${sentryNativeRoot}/build" -D SENTRY_BACKEND=crashpad -D SENTRY_SDK_NAME=sentry.native.unreal
cmake --build "${sentryNativeRoot}/build" --target sentry --config RelWithDebInfo --parallel
cmake --build "${sentryNativeRoot}/build" --target crashpad_handler --config Release --parallel

mkdir "${sentryArtifactsDestination}/bin"
mkdir "${sentryArtifactsDestination}/include"
mkdir "${sentryArtifactsDestination}/lib"

cp ${sentryNativeRoot}/build/RelWithDebInfo/sentry.lib ${sentryArtifactsDestination}/lib/sentry.lib
cp ${sentryNativeRoot}/build/RelWithDebInfo/sentry.dll ${sentryArtifactsDestination}/bin/sentry.dll
cp ${sentryNativeRoot}/build/RelWithDebInfo/sentry.pdb ${sentryArtifactsDestination}/bin/sentry.pdb
cp ${sentryNativeRoot}/build/crashpad_build/handler/Release/crashpad_handler.exe ${sentryArtifactsDestination}/bin/crashpad_handler.exe
cp ${sentryNativeRoot}/include/sentry.h ${sentryArtifactsDestination}/include/sentry.h
9 changes: 8 additions & 1 deletion scripts/download-sdks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,17 @@ if (-not (Test-Path $outDir))
New-Item $outDir -ItemType Directory > $null
}

$sdks = @("Android", "IOS", "Linux", "Mac", "Win64")
$sdks = @("Android", "IOS", "Linux", "Mac", "Win64-Crashpad", "Win64-Breakpad")
foreach ($sdk in $sdks)
{
$sdkDir = "$outDir/$sdk"

if ($sdk.StartsWith('Win64'))
{
$winSdk, $crashBackend = $sdk.Split("-")
$sdkDir = "$outDir/$winSdk/$crashBackend"
}

Write-Host "Downloading $sdk SDK to $sdkDir ..."
if (Test-Path $sdkDir)
{
Expand Down
9 changes: 8 additions & 1 deletion scripts/download-sdks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,17 @@ if [[ "$runId" == "" ]]; then
exit 1
fi

declare -a sdks=("Android" "IOS" "Linux" "Mac" "Win64")
declare -a sdks=("Android" "IOS" "Linux" "Mac")
for sdk in "${sdks[@]}"; do
echo "Downloading $sdk SDK to $PWD/$sdk ..."
rm -rf "./$sdk"
gh run download $runId -n "$sdk-sdk" -D $sdk
find $sdk -name "crashpad_handler" -exec chmod +x {} \;
done

rm -rf "./Win64"
declare -a winSdks=("Crashpad" "Breakpad")
for winSdk in "${winSdks[@]}"; do
echo "Downloading Win64-$winSdk SDK to $PWD/Win64/$winSdk ..."
gh run download $runId -n "Win64-$winSdk-sdk" -D Win64/$winSdk
done
89 changes: 54 additions & 35 deletions scripts/packaging/pack.ps1
Original file line number Diff line number Diff line change
@@ -1,42 +1,61 @@
Remove-Item "package-release" -Force -Recurse -ErrorAction SilentlyContinue
New-Item "package-release" -ItemType Directory

$exclude = @(
'Sentry.uplugin',
'.gitkeep',
'.DS_Store',
'Binaries',
'Intermediate',
'sentry-cli-*',
'upload-debug-symbols-win.bat',
'upload-debug-symbols.sh'
)

Copy-Item "plugin-dev/*" "package-release/" -Exclude $exclude -Recurse
Copy-Item "CHANGELOG.md" -Destination "package-release/CHANGELOG.md"
Copy-Item "LICENSE" -Destination "package-release/LICENSE"

$pluginSpec = Get-Content "plugin-dev/Sentry.uplugin"
$version = [regex]::Match("$pluginSpec", '"VersionName": "([^"]+)"').Groups[1].Value
$engineVersions = Get-Content $PSScriptRoot/engine-versions.txt
foreach ($engineVersion in $engineVersions)
{
$packageName = "sentry-unreal-$version-engine$engineVersion.zip"
Write-Host "Creating a release package for Unreal $engineVersion as $packageName"
# Packages plugin files for two publishing platforms - GitHub and UE Marketplace.

# The UE Marketplace version doesn't include `.exe`, `.bat` and `.sh` files due to certain
# platform restrictions: https://www.unrealengine.com/en-US/marketplace-guidelines#262e
# Plugin provides tools allowing to download these files manually.

$newPluginSpec = @($pluginSpec[0..0]) + @(' "EngineVersion" : "' + $engineVersion + '.0",') + @($pluginSpec[1..($pluginSpec.count)])
$newPluginSpec | Out-File 'package-release/Sentry.uplugin'
function packFiles([string] $publishingPlatform)
{
Remove-Item "package-release-$publishingPlatform" -Force -Recurse -ErrorAction SilentlyContinue
New-Item "package-release-$publishingPlatform" -ItemType Directory

Remove-Item -ErrorAction SilentlyContinue $packageName
$exclude = @(
'Sentry.uplugin',
'.gitkeep',
'.DS_Store',
'Binaries',
'Intermediate'
)

# Note: unlike `zip` (the info-ZIP program), Compress-archive doesn't preserve file permissions - messing up later usage on unix-based systems.
Push-Location package-release
try
if ($publishingPlatform -eq "marketplace")
{
zip -r -1 -v ../$packageName ./*
$exclude += @(
'sentry-cli-Windows-x86_64.exe',
'upload-debug-symbols-win.bat',
'upload-debug-symbols.sh',
'crashpad_handler.exe'
)
}
finally

Copy-Item "plugin-dev/*" "package-release-$publishingPlatform/" -Exclude $exclude -Recurse
Copy-Item "CHANGELOG.md" -Destination "package-release-$publishingPlatform/CHANGELOG.md"
Copy-Item "LICENSE" -Destination "package-release-$publishingPlatform/LICENSE"

$pluginSpec = Get-Content "plugin-dev/Sentry.uplugin"
$version = [regex]::Match("$pluginSpec", '"VersionName": "([^"]+)"').Groups[1].Value
$engineVersions = Get-Content $PSScriptRoot/engine-versions.txt
foreach ($engineVersion in $engineVersions)
{
Pop-Location
$packageName = "sentry-unreal-$version-engine$engineVersion-$publishingPlatform.zip"
Write-Host "Creating a release package for Unreal $engineVersion as $packageName"

$newPluginSpec = @($pluginSpec[0..0]) + @(' "EngineVersion" : "' + $engineVersion + '.0",') + @($pluginSpec[1..($pluginSpec.count)])
$newPluginSpec | Out-File "package-release-$publishingPlatform/Sentry.uplugin"

Remove-Item -ErrorAction SilentlyContinue $packageName

# Note: unlike `zip` (the info-ZIP program), Compress-archive doesn't preserve file permissions - messing up later usage on unix-based systems.
Push-Location package-release-$publishingPlatform
try
{
zip -r -1 -v ../$packageName ./*
}
finally
{
Pop-Location
}
}
}
}

packFiles("github")
packFiles("marketplace")
Loading