Skip to content

Commit 0b6dd56

Browse files
authored
feat: gradle 8 support (#103)
* fix: download symbol-upload-macos on demand * fix: download symbol-upload-windows.exe * fix: better windows logging * chore: ignore symuploader folder * fix: symbol upload tweaks * fix: skip symbols for editor build * fix: powershell for win64 symbol upload * fix: dont' use reserved powershell var name * fix: invoke upload-symbols-win64.ps1 * feat: symbol uploads for mac * feat: symbol uploads for mac * fix: bubble up editor check * feat: linux uploads (WIP) * chore: windows copyright * fix: correctly check symbol-upload-macos path * fix: download uploaders in pre-build step * chore: remove redundant symbol upload check * chore: remove todo * fix: gradle 8 support * fix: linux scripts
1 parent 84c160f commit 0b6dd56

17 files changed

+329
-152
lines changed

.gitattributes

Lines changed: 0 additions & 2 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,12 @@ DerivedDataCache/*
7272

7373
# Ignore auto-generated upload script
7474
Source/Scripts/BugSplat.bat
75+
Source/Scripts/upload-symbols-win64.ps1
76+
Source/Scripts/upload-symbols-mac.sh
7577

7678
# Mac OS
7779
.DS_Store
7880

7981
# Symbol Upload temp files
8082
Source/Scripts/tmp
81-
!Source/ThirdParty/SymUploader/*.exe
83+
Source/ThirdParty/SymUploader

BugSplat.uplugin

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,26 @@
3333
]
3434
}
3535
],
36+
"PreBuildSteps": {
37+
"Win64": [
38+
"powershell -ExecutionPolicy Bypass -File \"$(PluginDir)\\Source\\Scripts\\pre-build-win64.ps1\" $(TargetName) \"$(PluginDir)\""
39+
],
40+
"Mac": [
41+
"sh \"$(PluginDir)/Source/Scripts/pre-build-mac.sh\" $(TargetName) \"$(PluginDir)\""
42+
],
43+
"Linux": [
44+
"sh \"$(PluginDir)/Source/Scripts/pre-build-linux.sh\" $(TargetName) \"$(PluginDir)\""
45+
]
46+
},
3647
"PostBuildSteps": {
3748
"Win64": [
38-
"call \"$(PluginDir)\\Source\\Scripts\\upload-symbols-win64.bat\" $(TargetPlatform) \"$(ProjectDir)\" $(TargetName)"
49+
"powershell -ExecutionPolicy Bypass -File \"$(PluginDir)\\Source\\Scripts\\post-build-win64.ps1\" $(TargetPlatform) $(TargetName) \"$(ProjectDir)\" \"$(PluginDir)\""
3950
],
4051
"Mac": [
41-
"sh \"$(PluginDir)/Source/Scripts/setup-upload-symbols-ios.sh\" $(TargetPlatform) $(TargetName) \"$(ProjectDir)\" $(PluginDir)"
52+
"sh \"$(PluginDir)/Source/Scripts/post-build-mac.sh\" $(TargetPlatform) $(TargetName) \"$(ProjectDir)\" \"$(PluginDir)\""
53+
],
54+
"Linux": [
55+
"sh \"$(PluginDir)/Source/Scripts/post-build-linux.sh\" $(TargetPlatform) $(TargetName) \"$(ProjectDir)\" \"$(PluginDir)\""
4256
]
4357
}
4458
}

Source/BugSplat/Private/BugSplatSymbols.cpp

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ FBugSplatSymbols::FBugSplatSymbols()
1414
}
1515

1616

17-
// TODO BG Mac/Linux uploads
17+
// TODO BG Linux uploads
1818

1919
void FBugSplatSymbols::UpdateSymbolUploadsSettings()
2020
{
@@ -38,22 +38,23 @@ void FBugSplatSymbols::UpdateSymbolUploadsSettings()
3838

3939
FString FBugSplatSymbols::CreateSymbolUploadScript(FString Database, FString App, FString Version, FString ClientId, FString ClientSecret)
4040
{
41-
FString SetCurrentPlatfrom = TEXT("@echo off\nset targetPlatform=%1\nset targetName=%2\n");
42-
FString TargetPlatformNullGuard = TEXT("if \"%targetPlatform%\"==\"\" (\n\techo \"BugSplat [ERROR]: Symbol upload invocation missing target platform...\"\n\texit /b\n)");
43-
FString EditorPlatformGuard = TEXT("set isWindows=0\nif \"%targetPlatform%\"==\"Win64\" set isWindows=1\nif \"%targetPlatform%\"==\"XSX\" set isWindows=1\nif \"%targetPlatform%\"==\"XB1\" set isWindows=1\nif %isWindows%==0 (\n\techo \"BugSplat [INFO]: Non-Windows build detected, skipping Windows symbol uploads...\"\n\texit /b\n)");
41+
#if PLATFORM_WINDOWS
42+
FString SetCurrentPlatfrom = TEXT("$targetPlatform = $args[0]\n$targetName = $args[1]\n");
43+
FString TargetPlatformNullGuard = TEXT("if (-not $targetPlatform) {\n Write-Host 'BugSplat [ERROR]: Symbol upload invocation missing target platform...'\n exit 1\n}\n");
44+
FString EditorPlatformGuard = TEXT("$isWindowsTarget = $false\nif ($targetPlatform -eq 'Win64' -or $targetPlatform -eq 'XSX' -or $targetPlatform -eq 'XB1') {\n $isWindowsTarget = $true\n}\nif (-not $isWindowsTarget) {\n Write-Host 'BugSplat [INFO]: Non-Windows build detected, skipping Windows symbol uploads...'\n exit 0\n}\n");
4445

4546
FString PostBuildStepsConsoleCommandFormat =
4647
FString(
4748
"{0}\n" // Set Platform
4849
"{1}\n" // Target Platform Null Guard
4950
"{2}\n" // Editor Platform Guard
50-
"\"{3}\" " // Uploader Path
51+
"& \"{3}\" " // Uploader Path
5152
"-i {4} " // Client ID
5253
"-s {5} " // Client Secret
5354
"-b {6} " // Database
5455
"-a \"{7}\" " // Application
5556
"-v \"{8}\" " // Version
56-
"-d \"{9}/%targetPlatform%\" " // Output Directory
57+
"-d \"{9}/$targetPlatform\" " // Output Directory
5758
"-f \"{10}\" " // File Pattern
5859
);
5960

@@ -71,9 +72,44 @@ FString FBugSplatSymbols::CreateSymbolUploadScript(FString Database, FString App
7172
args.Add(FString("**/*.{pdb,dll,exe}"));
7273

7374
return FString::Format(*PostBuildStepsConsoleCommandFormat, args);
75+
#elif PLATFORM_MAC
76+
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");
78+
79+
FString PostBuildStepsConsoleCommandFormat =
80+
FString(
81+
"#!/bin/bash\n"
82+
"{0}\n" // Target Platform Check
83+
"{1}\n" // Platform Guard
84+
"\"{2}\" " // Uploader Path
85+
"-i {3} " // Client ID
86+
"-s {4} " // Client Secret
87+
"-b {5} " // Database
88+
"-a \"{6}\" " // Application
89+
"-v \"{7}\" " // Version
90+
"-d \"{8}/$1\" " // Output Directory
91+
"-f \"{9}\" " // File Pattern
92+
);
93+
94+
FStringFormatOrderedArguments args;
95+
args.Add(TargetPlatformCheck);
96+
args.Add(PlatformGuard);
97+
args.Add(BUGSPLAT_SYMBOL_UPLOADER_PATH);
98+
args.Add(ClientId);
99+
args.Add(ClientSecret);
100+
args.Add(Database);
101+
args.Add(App);
102+
args.Add(Version);
103+
args.Add(FPaths::Combine(FPaths::ConvertRelativePathToFull(FPaths::ProjectDir()), FString("Binaries")));
104+
args.Add(FString("**/*.{app,dSYM}"));
105+
106+
return FString::Format(*PostBuildStepsConsoleCommandFormat, args);
107+
#else
108+
return TEXT("echo \"BugSplat [INFO]: Symbol uploads not supported on this platform\"");
109+
#endif
74110
}
75111

76112
void FBugSplatSymbols::WriteSymbolUploadScript(FString Contents)
77113
{
78-
FFileHelper::SaveStringToFile(Contents, *BUGSPLAT_BASH_DIR);
114+
FFileHelper::SaveStringToFile(Contents, *BUGSPLAT_SYMBOL_UPLOAD_SCRIPT_PATH);
79115
}

Source/BugSplat/Public/BugSplatSymbols.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@
77
#include "Interfaces/IPluginManager.h"
88

99
static const FString PLUGIN_BASE_DIR = FPaths::ConvertRelativePathToFull(IPluginManager::Get().FindPlugin(TEXT("BugSplat"))->GetBaseDir());
10+
11+
#if PLATFORM_MAC
12+
static const FString BUGSPLAT_SYMBOL_UPLOADER_PATH = *FPaths::Combine(PLUGIN_BASE_DIR, FString("/Source/ThirdParty/SymUploader/symbol-upload-macos"));
13+
static const FString BUGSPLAT_SYMBOL_UPLOAD_SCRIPT_PATH = *FPaths::Combine(FPaths::ProjectDir(), FString("Plugins/BugSplat/Source/Scripts/upload-symbols-mac.sh"));
14+
#else
1015
static const FString BUGSPLAT_SYMBOL_UPLOADER_PATH = *FPaths::Combine(PLUGIN_BASE_DIR, FString("/Source/ThirdParty/SymUploader/symbol-upload-windows.exe"));
11-
static const FString BUGSPLAT_BASH_DIR = *FPaths::Combine(FPaths::ProjectDir(), FString("Plugins/BugSplat/Source/Scripts/BugSplat.bat"));
16+
static const FString BUGSPLAT_SYMBOL_UPLOAD_SCRIPT_PATH = *FPaths::Combine(FPaths::ProjectDir(), FString("Plugins/BugSplat/Source/Scripts/upload-symbols-win64.ps1"));
17+
#endif
1218

1319
class FBugSplatSymbols
1420
{

Source/BugSplatRuntime/Bugsplat_Android_UPL.xml

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@
1313
<setStringFromProperty result="bugsplatClientSecret" ini="Engine" section="/Script/BugSplatRuntime.BugSplatEditorSettings" property="BugSplatClientSecret" />
1414

1515
<setString result="uploaderDirPath" value="$S(AbsPluginDir)/../ThirdParty/SymUploader/"/>
16-
1716
<setBoolIsEqual result="bIsShipping" arg1="$S(Configuration)" arg2="Shipping"/>
1817

1918
<if condition="bIsShipping">
2019
<true>
21-
<setString result="artifactsDirPath" value="$S(BuildDir)/gradle/app/build/intermediates/merged_native_libs/release/out/lib/$S(Architecture)"/>
20+
<setString result="baseArtifactsDir" value="$S(BuildDir)/gradle/app/build/intermediates/merged_native_libs/release"/>
2221
</true>
2322
<false>
24-
<setString result="artifactsDirPath" value="$S(BuildDir)/gradle/app/build/intermediates/merged_native_libs/debug/out/lib/$S(Architecture)"/>
23+
<setString result="baseArtifactsDir" value="$S(BuildDir)/gradle/app/build/intermediates/merged_native_libs/debug"/>
2524
</false>
2625
</if>
2726
</init>
@@ -58,16 +57,10 @@
5857
<insert>
5958
import org.apache.tools.ant.taskdefs.condition.Os
6059

61-
def checkExecResult(execResult, failText, standardOutput) {
62-
if (execResult) {
63-
if (execResult.getExitValue() != 0) {
64-
throw new GradleException('Non-zero exit value: ' + execResult.getExitValue())
65-
}
66-
if (standardOutput.toString().contains(failText)) {
67-
throw new GradleException('"' + failText + '" string in output: ' + standardOutput.toString())
68-
}
69-
} else {
70-
throw new GradleException('Returned a null execResult object')
60+
def checkExecResult(failText, standardOutput) {
61+
def output = standardOutput.toString()
62+
if (output.contains(failText)) {
63+
throw new GradleException('"' + failText + '" found in output: ' + output)
7164
}
7265
}
7366

@@ -78,49 +71,51 @@
7871
if (Os.isFamily(Os.FAMILY_MAC)) {
7972
return 'symbol-upload-macos'
8073
}
81-
if (Os.isFamily(Os.FAMILY_MAC)) {
74+
if (Os.isFamily(Os.FAMILY_UNIX)) {
8275
return 'symbol-upload-linux'
8376
}
84-
return '';
77+
return ''
8578
}
8679

87-
8880
def deleteFiles(deleteDirPath, fileType) {
8981
delete fileTree(dir: deleteDirPath, include: fileType)
9082
}
9183

9284
def uploaderExec = '</insert><insertValue value="$S(uploaderDirPath)"/><insert>' + getUploaderExecName()
93-
def artifactsDirPath = '</insert><insertValue value="$S(artifactsDirPath)"/><insert>'
85+
def baseArtifactsDir = '</insert><insertValue value="$S(baseArtifactsDir)"/><insert>'
9486
def bugsplatDatabase = '</insert><insertValue value="$S(bugsplatDatabase)"/><insert>'
9587
def bugsplatApp = '</insert><insertValue value="$S(bugsplatApp)"/><insert>'
9688
def bugsplatVersion = '</insert><insertValue value="$S(bugsplatVersion)"/><insert>-android'
9789
def bugsplatClientId = '</insert><insertValue value="$S(bugsplatClientId)"/><insert>'
9890
def bugsplatClientSecret = '</insert><insertValue value="$S(bugsplatClientSecret)"/><insert>'
91+
def architecture = '</insert><insertValue value="$S(Architecture)"/><insert>'
9992

10093
task cleanUpSymbols() {
10194
doLast {
102-
deleteFiles(artifactsDirPath, '*.sym')
95+
deleteFiles(baseArtifactsDir, '*.sym')
10396
}
10497
}
10598

106-
task uploadSymbols(type:Exec) {
107-
standardOutput = new ByteArrayOutputStream();
99+
task uploadSymbols(type: Exec) {
100+
standardOutput = new ByteArrayOutputStream()
108101

109-
commandLine uploaderExec, '-b', bugsplatDatabase, '-a', bugsplatApp, '-v', bugsplatVersion, '-f', '**/*.so', '-d', artifactsDirPath, '-i', bugsplatClientId, '-s', bugsplatClientSecret, '-m'
102+
commandLine uploaderExec, '-b', bugsplatDatabase, '-a', bugsplatApp, '-v', bugsplatVersion,
103+
'-f', '**/' + architecture + '/**/*.so', '-d', baseArtifactsDir,
104+
'-i', bugsplatClientId, '-s', bugsplatClientSecret, '-m'
110105

111106
doLast {
112-
checkExecResult(execResult, 'Error', standardOutput);
107+
checkExecResult('Error', standardOutput)
113108
}
114109

115110
finalizedBy cleanUpSymbols
116111
}
117112

118113
tasks.whenTaskAdded { task ->
119114
if (
120-
task.name == 'ue4CompleteDebug' ||
121-
task.name == 'ue4CompleteRelease' ||
122-
task.name == 'ueCompleteDebug' ||
123-
task.name == 'ueCompleteRelease'
115+
task.name == 'ue4CompleteDebug' ||
116+
task.name == 'ue4CompleteRelease' ||
117+
task.name == 'ueCompleteDebug' ||
118+
task.name == 'ueCompleteRelease'
124119
) {
125120
task.finalizedBy 'uploadSymbols'
126121
}
@@ -136,5 +131,4 @@
136131
-keepclassmembers class com.bugsplat.android.BugSplatBridge { *; }
137132
</insert>
138133
</proguardAdditions>
139-
140-
</root>
134+
</root>

Source/Scripts/post-build-linux.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
# Copyright (C) BugSplat. All Rights Reserved.
3+
4+
export targetPlatform=$1
5+
export targetName=$2
6+
export projectPath=$3
7+
export pluginPath=$4
8+
9+
export binariesPath=$projectPath/Binaries/Linux
10+
export configPath=$projectPath/Config
11+
export scriptsPath=$pluginPath/Source/Scripts
12+
13+
export uploaderFolderPath=$pluginPath/Source/ThirdParty/SymUploader
14+
export uploaderPath=$uploaderFolderPath/symbol-upload-linux
15+
16+
echo "BugSplat [INFO]: Input target platform: $targetPlatform"
17+
echo "BugSplat [INFO]: Input target name: $targetName"
18+
echo "BugSplat [INFO]: Input binaries path: $binariesPath"
19+
echo "BugSplat [INFO]: Input config path: $configPath"
20+
echo "BugSplat [INFO]: Input scripts path: $scriptsPath"
21+
echo "BugSplat [INFO]: Symbol uploader path: $uploaderPath"
22+
23+
if echo "$targetName" | grep -q "Editor"; then
24+
echo "BugSplat [INFO]: Editor build detected, skipping symbol upload..."
25+
exit
26+
fi
27+
28+
if [ "$targetPlatform" != "Linux" ]; then
29+
echo "BugSplat [WARN]: Unexpected platform ${targetPlatform}, skipping symbol upload..."
30+
exit
31+
fi
32+
33+
echo "BugSplat [WARN]: Symbol uploads for Linux are not supported yet"

0 commit comments

Comments
 (0)