Skip to content

Commit 4ec6db1

Browse files
tustanivskyvaind
andauthored
Add debug symbols upload (#59)
* Add CLI tools * Add debug symbols upload for iOS, Mac and Linux * Add debug symbols upload script for Windows * Fix errors with debug symbols upload on Linux * Remove redundant script * Update location of symbols upload scripts * Update .gitignore * Fix packaging issue on Linux * Add plugin binaries symbols upload * Remove Sentry CLI binaries * Fix download script * Fix workflow * Fix script name * Fix workflow once again * Fix empty line * Fix typo * Fix CLI pathj * Remo redundant message * Fix CLI download sript * Remo user credentials for debug symbols upload from plugin settings * Update debug symbols upload script for win * Fix regex * Update changelog * chore: rename cli download script * use sentry.properties as a relative path * fix: android debug symbol upload * Fix issue with reading sentry.properties file path from settings on Mac Co-authored-by: Ivan Dlugos <[email protected]>
1 parent ed92731 commit 4ec6db1

20 files changed

+346
-157
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ jobs:
4141
- name: Checkout
4242
uses: actions/checkout@v3
4343

44+
- name: Download CLI
45+
shell: pwsh
46+
run: ./scripts/download-cli.ps1
47+
4448
- uses: actions/download-artifact@v2
4549
with:
4650
name: Android-sdk

.github/workflows/update-dependencies.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,13 @@ jobs:
3131
with:
3232
path: modules/sentry-cocoa
3333
name: Cocoa SDK (iOS)
34+
secrets:
35+
api_token: ${{ secrets.CI_DEPLOY_KEY }}
36+
37+
cli:
38+
uses: getsentry/github-workflows/.github/workflows/updater.yml@v1
39+
with:
40+
path: modules/sentry-cli.properties
41+
name: CLI
3442
secrets:
3543
api_token: ${{ secrets.CI_DEPLOY_KEY }}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Features
66

7+
- Add debug symbols upload ([#59](https://github.com/getsentry/sentry-unreal/pull/59))
78
- Bump Cocoa SDK (iOS) to v7.21.0 ([#37](https://github.com/getsentry/sentry-unreal/pull/37))
89
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/master/CHANGELOG.md#7210)
910
- [diff](https://github.com/getsentry/sentry-cocoa/compare/7.14.0...7.21.0)

modules/sentry-cli.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version=2.5.0
2+
repo=https://github.com/getsentry/sentry-cli

plugin-dev/Config/FilterPlugin.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@
66
; /README.txt
77
; /Extras/...
88
; /Binaries/ThirdParty/*.dll
9+
10+
/Scripts/...

plugin-dev/Resources/sentry.properties

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
param([string] $TargetPlatform, [string] $TargetName, [string] $TargetType, [string] $ProjectPath, [string] $PluginPath)
2+
3+
$ProjectBinariesPath = "$ProjectPath\Binaries\$TargetPlatform"
4+
$PluginBinariesPath = "$PluginPath\Source\ThirdParty\$TargetPlatform"
5+
$ConfigPath = "$ProjectPath\Config"
6+
7+
Write-Host "Sentry: Start debug symbols upload"
8+
9+
If ($TargetType -eq "Editor")
10+
{
11+
Write-Host "Sentry: Automatic symbols upload is not required for Editor target. Skipping..."
12+
Exit
13+
}
14+
15+
If ($TargetPlatform -eq "Win64")
16+
{
17+
$CliExec = "$PluginPath\Source\ThirdParty\CLI\sentry-cli-Windows-x86_64.exe"
18+
}
19+
Else
20+
{
21+
Write-Warning "Sentry: Unexpected platform $TargetPlatform. Skipping..."
22+
Exit
23+
}
24+
25+
function ParseIniFile
26+
{
27+
param([parameter(Mandatory = $true)] [string] $filePath)
28+
29+
$anonymous = "NoSection"
30+
31+
$ini = @{}
32+
switch -regex -file $filePath
33+
{
34+
"^\[(.+)\]$" # Section
35+
{
36+
$section = $matches[1]
37+
$ini[$section] = @{}
38+
$CommentCount = 0
39+
}
40+
41+
"^(;.*)$" # Comment
42+
{
43+
if (!($section))
44+
{
45+
$section = $anonymous
46+
$ini[$section] = @{}
47+
}
48+
$value = $matches[1]
49+
$CommentCount = $CommentCount + 1
50+
$name = "Comment" + $CommentCount
51+
$ini[$section][$name] = $value
52+
}
53+
54+
"(.+?)\s*=\s*(.*)" # Key
55+
{
56+
if (!($section))
57+
{
58+
$section = $anonymous
59+
$ini[$section] = @{}
60+
}
61+
$name, $value = $matches[1..2]
62+
$ini[$section][$name] = $value
63+
}
64+
}
65+
66+
return $ini
67+
}
68+
69+
$ConfigIni = ParseIniFile "$ConfigPath\DefaultEngine.ini"
70+
$SentrySettingsSection = "/Script/Sentry.SentrySettings"
71+
72+
$UploadSymbols = $ConfigIni.$SentrySettingsSection.UploadSymbolsAutomatically
73+
74+
If ("$UploadSymbols".ToLower() -ne "true")
75+
{
76+
Write-Host "Sentry: Automatic symbols upload is disabled in plugin settings. Skipping..."
77+
Exit
78+
}
79+
80+
Write-Host "Sentry: Parse project settings"
81+
82+
$PropertiesFile = "$ProjectPath/$($ConfigIni.$SentrySettingsSection.PropertiesFilePath)".Replace('\', '/')
83+
84+
Write-Host "Sentry: Upload started using PropertiesFile '$PropertiesFile'"
85+
86+
$env:SENTRY_PROPERTIES = $PropertiesFile
87+
& $CliExec upload-dif --include-sources --log-level info $ProjectBinariesPath $PluginBinariesPath
88+
89+
Write-Host "Sentry: Upload finished"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
targetPlatform=$1
4+
targetName=$2
5+
targetType=$3
6+
projectPath=$4
7+
pluginPath=$5
8+
9+
PROJECT_BINARIES_PATH=$projectPath/Binaries/$targetPlatform
10+
PLUGIN_BINARIES_PATH=$pluginPath/Source/ThirdParty/$targetPlatform
11+
CONFIG_PATH=$projectPath/Config
12+
13+
echo "Sentry: Start debug symbols upload"
14+
15+
if [ $targetType = "Editor" ]; then
16+
echo "Sentry: Automatic symbols upload is not required for Editor target. Skipping..."
17+
exit
18+
fi
19+
20+
if [ $targetPlatform = "IOS" ] || [ $targetPlatform = "Mac" ]; then
21+
SENTRY_CLI_EXEC=$pluginPath/Source/ThirdParty/CLI/sentry-cli-Darwin-universal
22+
elif [ $targetPlatform = "Linux" ]; then
23+
SENTRY_CLI_EXEC=$pluginPath/Source/ThirdParty/CLI/sentry-cli-Linux-x86_64
24+
else
25+
echo "Sentry: Unexpected platform ${targetPlatform}. Skipping..."
26+
exit
27+
fi
28+
29+
UPLOAD_SYMBOLS=$(awk -F "=" '/UploadSymbolsAutomatically/ {print $2}' ${CONFIG_PATH}/DefaultEngine.ini)
30+
31+
if [ -z $UPLOAD_SYMBOLS ]; then
32+
echo "Sentry: Automatic symbols upload is disabled in plugin settings. Skipping..."
33+
exit
34+
fi
35+
36+
if [ $UPLOAD_SYMBOLS != "True" ]; then
37+
echo "Sentry: Automatic symbols upload is disabled in plugin settings. Skipping..."
38+
exit
39+
fi
40+
41+
PROP_FILE_PATH=$(awk -F "=" '/PropertiesFilePath/ {print $2}' ${CONFIG_PATH}/DefaultEngine.ini)
42+
43+
export SENTRY_PROPERTIES="$projectPath/$PROP_FILE_PATH"
44+
45+
echo "Sentry: Upload started using PropertiesFile '$SENTRY_PROPERTIES'"
46+
47+
chmod +x $SENTRY_CLI_EXEC
48+
49+
$SENTRY_CLI_EXEC upload-dif --include-sources $PROJECT_BINARIES_PATH $PLUGIN_BINARIES_PATH
50+
51+
echo "Sentry: Upload finished"

plugin-dev/Sentry.uplugin

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,17 @@
2121
"LoadingPhase": "Default",
2222
"WhitelistPlatforms": [ "Win64", "Mac", "Android", "IOS", "Linux" ]
2323
}
24-
]
24+
],
25+
"PostBuildSteps":
26+
{
27+
"Mac": [
28+
"sh $(PluginDir)/Scripts/upload-debug-symbols.sh $(TargetPlatform) $(TargetName) $(TargetType) $(ProjectDir) $(PluginDir)"
29+
],
30+
"Linux": [
31+
"sh $(PluginDir)/Scripts/upload-debug-symbols.sh $(TargetPlatform) $(TargetName) $(TargetType) $(ProjectDir) $(PluginDir)"
32+
],
33+
"Win64": [
34+
"powershell -ExecutionPolicy RemoteSigned -File $(PluginDir)/Scripts/upload-debug-symbols-win.ps1 $(TargetPlatform) $(TargetName) $(TargetType) $(ProjectDir) $(PluginDir)"
35+
]
36+
}
2537
}

plugin-dev/Source/Sentry/Private/SentrySettings.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,10 @@
22

33
#include "SentrySettings.h"
44

5-
USentrySettings::USentrySettings(const FObjectInitializer& ObjectInitializer)
6-
: Super(ObjectInitializer)
7-
, InitAutomatically(false)
8-
, UploadSymbolsAutomatically(false)
9-
{
10-
DsnUrl = TEXT("");
11-
Release = TEXT("");
12-
ProjectName = TEXT("");
13-
OrganisationName = TEXT("");
14-
AuthToken = TEXT("");
5+
USentrySettings::USentrySettings(const FObjectInitializer &ObjectInitializer)
6+
: Super(ObjectInitializer), InitAutomatically(false),
7+
UploadSymbolsAutomatically(false) {
8+
DsnUrl = TEXT("");
9+
Release = TEXT("");
10+
PropertiesFilePath = TEXT("Config/sentry.properties");
1511
}

0 commit comments

Comments
 (0)