Skip to content

Commit 1d1ce74

Browse files
authored
feat: macos and linux symbol uploads (#104)
* chore: build instructions for macos * feat: linux symbol uploads * chore: remove unused upload-symbols-mac.sh args * chore: remove extraneous iOS guard in mac symbol uploads * fix: enable linux symbol uploads * fix: symbol upload script fixes * fix: ignore generated linux upload script
1 parent d134657 commit 1d1ce74

File tree

6 files changed

+54
-4
lines changed

6 files changed

+54
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ DerivedDataCache/*
7474
Source/Scripts/BugSplat.bat
7575
Source/Scripts/upload-symbols-win64.ps1
7676
Source/Scripts/upload-symbols-mac.sh
77+
Source/Scripts/upload-symbols-linux.sh
7778

7879
# Mac OS
7980
.DS_Store

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ You may choose to add BugSplat through the Unreal Marketplace or add the plugin
3434

3535
1. Navigate to your project folder containing your `[ProjectName].uproject` file.
3636
2. Create a `Plugins` folder if it does not already exist.
37-
3. Create a `BugSplat` folder in the `Plugins` folder and copy the contents of this repo into the `BugSplat` folder. Please note, if you're cloning this repo on macOS or Linux, you'll need to use [Git LFS](https://git-lfs.com/) and `git lfs fetch --all` to download our [symbol-upload](https://github.com/BugSplat-Git/bugsplat-unreal/tree/main/Source/ThirdParty/SymUploader) tool.
37+
3. Create a `BugSplat` folder in the `Plugins` folder and copy the contents of this repo into the `BugSplat` folder.
3838
4. In the Unreal Editor, ensure you can access the BugSplat plugin via `Edit > Project Settings` and scroll to the `BugSplat` section under `Plugins`.
3939

4040
## ⚙️ Configuration
@@ -57,6 +57,15 @@ To configure `CrashReportClient` to post to BugSplat, the `DataRouterUrl` value
5757

5858
In order to get function names and line numbers in crash reports, you'll need to upload your game's `.exe`, `.dll`, and `.pdb` files. To upload debug symbols for reach build, ensure that the `Enable Automatic Symbol Uploads` option is selected. When selected, a script to execute [symbol-upload](https://github.com/BugSplat-Git/symbol-upload) will be added to the `PostBuildSteps` field in `BugSplat.uplugin`. The symbol upload script will run automatically when your game is built.
5959

60+
#### macOS
61+
62+
To create a `.dSYM` file for a macOS build invoke `RunUAT.command` with the `-EnableDSym` flag per the example below:
63+
64+
```sh
65+
../../../Engine/Build/BatchFiles/Mac/Build.sh -Project="../../my-unreal-crasher/MyUnrealCrasher.uproject" MyUnrealCrasher Mac Development -NoEditor -EnableDSym -TargetPath="~/Desktop/UnrealEngine"
66+
```
67+
68+
6069
### iOS and Android
6170

6271
Before attempting to use the BugSplat plugin to capture crashes on Mobile, please ensure you've completed the [iOS](https://docs.unrealengine.com/5.0/en-US/setting-up-an-unreal-engine-project-for-ios/) and [Android](https://docs.unrealengine.com/5.0/en-US/android-support-for-unreal-engine/) quickstart guides.

Source/BugSplat/Private/BugSplatSymbols.cpp

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ FString FBugSplatSymbols::CreateSymbolUploadScript(FString Database, FString App
7474
return FString::Format(*PostBuildStepsConsoleCommandFormat, args);
7575
#elif PLATFORM_MAC
7676
FString TargetPlatformCheck = TEXT("if [ -z \"$1\" ]; then\n echo \"BugSplat [ERROR]: Symbol upload invocation missing target platform...\"\n exit 1\nfi\n");
77-
FString PlatformGuard = TEXT("if [ \"$1\" != \"Mac\" ] && [ \"$1\" != \"IOS\" ]; then\n echo \"BugSplat [INFO]: Non-Apple build detected, skipping Mac/iOS symbol uploads...\"\n exit 0\nfi\n");
77+
FString PlatformGuard = TEXT("if [ \"$1\" != \"Mac\" ]; then\n echo \"BugSplat [INFO]: Non-Mac build detected, skipping Mac symbol uploads...\"\n exit 0\nfi\n");
7878

7979
FString PostBuildStepsConsoleCommandFormat =
8080
FString(
@@ -103,6 +103,38 @@ FString FBugSplatSymbols::CreateSymbolUploadScript(FString Database, FString App
103103
args.Add(FPaths::Combine(FPaths::ConvertRelativePathToFull(FPaths::ProjectDir()), FString("Binaries")));
104104
args.Add(FString("**/*.{app,dSYM}"));
105105

106+
return FString::Format(*PostBuildStepsConsoleCommandFormat, args);
107+
#elif PLATFORM_LINUX
108+
FString TargetPlatformCheck = TEXT("if [ -z \"$1\" ]; then\n echo \"BugSplat [ERROR]: Symbol upload invocation missing target platform...\"\n exit 1\nfi\n");
109+
FString PlatformGuard = TEXT("if [ \"$1\" != \"Linux\" ]; then\n echo \"BugSplat [INFO]: Non-Linux build detected, skipping Linux symbol uploads...\"\n exit 0\nfi\n");
110+
111+
FString PostBuildStepsConsoleCommandFormat =
112+
FString(
113+
"#!/bin/bash\n"
114+
"{0}\n" // Target Platform Check
115+
"{1}\n" // Platform Guard
116+
"\"{2}\" " // Uploader Path
117+
"-i {3} " // Client ID
118+
"-s {4} " // Client Secret
119+
"-b {5} " // Database
120+
"-a \"{6}\" " // Application
121+
"-v \"{7}\" " // Version
122+
"-d \"{8}/$1\" " // Output Directory
123+
"-f \"{9}\" " // File Pattern
124+
);
125+
126+
FStringFormatOrderedArguments args;
127+
args.Add(TargetPlatformCheck);
128+
args.Add(PlatformGuard);
129+
args.Add(BUGSPLAT_SYMBOL_UPLOADER_PATH);
130+
args.Add(ClientId);
131+
args.Add(ClientSecret);
132+
args.Add(Database);
133+
args.Add(App);
134+
args.Add(Version);
135+
args.Add(FPaths::Combine(FPaths::ConvertRelativePathToFull(FPaths::ProjectDir()), FString("Binaries")));
136+
args.Add(FString("**/*.sym"));
137+
106138
return FString::Format(*PostBuildStepsConsoleCommandFormat, args);
107139
#else
108140
return TEXT("echo \"BugSplat [INFO]: Symbol uploads not supported on this platform\"");

Source/BugSplat/Public/BugSplatSymbols.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ static const FString PLUGIN_BASE_DIR = FPaths::ConvertRelativePathToFull(IPlugin
1111
#if PLATFORM_MAC
1212
static const FString BUGSPLAT_SYMBOL_UPLOADER_PATH = *FPaths::Combine(PLUGIN_BASE_DIR, FString("/Source/ThirdParty/SymUploader/symbol-upload-macos"));
1313
static const FString BUGSPLAT_SYMBOL_UPLOAD_SCRIPT_PATH = *FPaths::Combine(FPaths::ProjectDir(), FString("Plugins/BugSplat/Source/Scripts/upload-symbols-mac.sh"));
14+
#elif PLATFORM_LINUX
15+
static const FString BUGSPLAT_SYMBOL_UPLOADER_PATH = *FPaths::Combine(PLUGIN_BASE_DIR, FString("/Source/ThirdParty/SymUploader/symbol-upload-linux"));
16+
static const FString BUGSPLAT_SYMBOL_UPLOAD_SCRIPT_PATH = *FPaths::Combine(FPaths::ProjectDir(), FString("Plugins/BugSplat/Source/Scripts/upload-symbols-linux.sh"));
1417
#else
1518
static const FString BUGSPLAT_SYMBOL_UPLOADER_PATH = *FPaths::Combine(PLUGIN_BASE_DIR, FString("/Source/ThirdParty/SymUploader/symbol-upload-windows.exe"));
1619
static const FString BUGSPLAT_SYMBOL_UPLOAD_SCRIPT_PATH = *FPaths::Combine(FPaths::ProjectDir(), FString("Plugins/BugSplat/Source/Scripts/upload-symbols-win64.ps1"));

Source/Scripts/post-build-linux.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,9 @@ if [ "$targetPlatform" != "Linux" ]; then
3030
exit
3131
fi
3232

33-
echo "BugSplat [WARN]: Symbol uploads for Linux are not supported yet"
33+
if [ -f "$scriptsPath/upload-symbols-linux.sh" ]; then
34+
echo "BugSplat [INFO]: Running upload-symbols-linux.sh"
35+
sh "$scriptsPath/upload-symbols-linux.sh" "$targetPlatform" "$targetName"
36+
else
37+
echo "BugSplat [WARN]: Symbol uploads not configured via plugin - skipping..."
38+
fi

Source/Scripts/post-build-mac.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fi
3232

3333
if [ "$targetPlatform" == "Mac" ] && [ -f "$scriptsPath/upload-symbols-mac.sh" ]; then
3434
echo "BugSplat [INFO]: Running upload-symbols-mac.sh"
35-
sh "$scriptsPath/upload-symbols-mac.sh" -f "$binariesPath/$targetName.zip" -u "$uploaderPath"
35+
sh "$scriptsPath/upload-symbols-mac.sh" "$targetPlatform" "$targetName"
3636
exit
3737
elif [ "$targetPlatform" == "Mac" ]; then
3838
echo "BugSplat [WARN]: Symbol uploads not configured via plugin - skipping..."

0 commit comments

Comments
 (0)