Skip to content

Commit 5bea8a6

Browse files
authored
Fix issues in FAB plugin package (#1024)
* Update marketplace version check * Add post-build step to copy Win binaries to output dir (required for FAB package) * Add execute permission for sentry-cli on Mac * Remove IsMarketplace variable
1 parent 36b901e commit 5bea8a6

File tree

3 files changed

+17
-25
lines changed

3 files changed

+17
-25
lines changed

plugin-dev/Sentry.uplugin

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"PreBuildSteps":
3232
{
3333
"Mac": [
34-
"if [ -f \"$(PluginDir)/Scripts/upload-debug-symbols.sh\" ]; then\n chmod +x \"$(PluginDir)/Scripts/upload-debug-symbols.sh\" \nfi"
34+
"if [ -f \"$(PluginDir)/Scripts/upload-debug-symbols.sh\" ]; then\n chmod +x \"$(PluginDir)/Scripts/upload-debug-symbols.sh\" \nfi",
35+
"if [ -f \"$(PluginDir)/Source/ThirdParty/CLI/sentry-cli-Darwin-universal\" ]; then\n chmod +x \"$(PluginDir)/Source/ThirdParty/CLI/sentry-cli-Darwin-universal\" \nfi"
3536
]
3637
},
3738
"PostBuildSteps":
@@ -44,9 +45,11 @@
4445
"if [ -f \"$(PluginDir)/Scripts/upload-debug-symbols.sh\" ]; then\n \"$(PluginDir)/Scripts/upload-debug-symbols.sh\" $(TargetPlatform) $(TargetName) $(TargetType) $(TargetConfiguration) \"$(ProjectDir)\" \"$(PluginDir)\"\nelse\n echo \"Sentry: Symbol upload script is missing. Skipping post build step.\"\nfi"
4546
],
4647
"Win64": [
47-
"setlocal enabledelayedexpansion",
48-
"set \"CRASHPAD_HANDLER=$(PluginDir)/Binaries/Linux/crashpad_handler\"",
49-
"if \"$(TargetPlatform)\"==\"Linux\" (\n if not exist \"%CRASHPAD_HANDLER%\" (xcopy \"$(PluginDir)/Source/ThirdParty/Linux/bin/*\" \"$(PluginDir)/Binaries/Linux/\" /F /R /Y /I)\n)",
48+
"setlocal enabledelayedexpansion",
49+
"set \"CRASHPAD_HANDLER_LINUX=$(PluginDir)/Binaries/Linux/crashpad_handler\"",
50+
"if \"$(TargetPlatform)\"==\"Linux\" (\n if not exist \"%CRASHPAD_HANDLER_LINUX%\" (xcopy \"$(PluginDir)/Source/ThirdParty/Linux/bin/*\" \"$(PluginDir)/Binaries/Linux/\" /F /R /Y /I)\n)",
51+
"set \"CRASHPAD_HANDLER_WIN=$(PluginDir)/Binaries/Win64/crashpad_handler.exe\"",
52+
"if \"$(TargetPlatform)\"==\"Win64\" (\n if not exist \"%CRASHPAD_HANDLER_WIN%\" (xcopy \"$(PluginDir)/Source/ThirdParty/Win64/Crashpad/bin/*\" \"$(PluginDir)/Binaries/Win64/\" /F /R /Y /I)\n)",
5053
"set \"SYM_UPLOAD_SCRIPT=$(PluginDir)/Scripts/upload-debug-symbols-win.bat\"",
5154
"if exist \"%SYM_UPLOAD_SCRIPT%\" (call \"%SYM_UPLOAD_SCRIPT%\" $(TargetPlatform) $(TargetName) $(TargetType) $(TargetConfiguration) \"$(ProjectDir)\" \"$(PluginDir)\") else (\necho Warning: Sentry: Symbol upload script is missing. Skipping post build step.\n)",
5255
"endlocal"

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
const FName FSentryModule::ModuleName = "Sentry";
1818

19-
const bool FSentryModule::IsMarketplace = false;
20-
2119
void FSentryModule::StartupModule()
2220
{
2321
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
@@ -117,7 +115,16 @@ FString FSentryModule::GetPluginVersion()
117115

118116
bool FSentryModule::IsMarketplaceVersion()
119117
{
120-
return IsMarketplace;
118+
// Marketplace version check heuristic:
119+
// In case the plugin installed via Epic Games launcher path to its base dir supposed to be <EngineDir>/Plugins/Marketplace/Sentry
120+
// This approach is not foolproof as users may manually copy plugin to this location
121+
122+
const FString PluginPath = FPaths::ConvertRelativePathToFull(
123+
IPluginManager::Get().FindPlugin(TEXT("Sentry"))->GetBaseDir());
124+
const FString MarketplacePrefix = FPaths::ConvertRelativePathToFull(
125+
FPaths::Combine(FPaths::EnginePluginsDir(), TEXT("Marketplace")));
126+
127+
return PluginPath.StartsWith(MarketplacePrefix);
121128
}
122129

123130
#if PLATFORM_MAC

scripts/packaging/pack.ps1

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,6 @@ function packFiles([string] $publishingPlatform)
3232
Copy-Item "CHANGELOG.md" -Destination "package-release-$publishingPlatform/CHANGELOG.md"
3333
Copy-Item "LICENSE" -Destination "package-release-$publishingPlatform/LICENSE"
3434

35-
if ($publishingPlatform -eq "marketplace")
36-
{
37-
# Workaround for PowerShell 5.1 writing UTF8-BOM
38-
# ======
39-
# Set current directory so that ::WriteAllLines can accept a relative path
40-
[System.Environment]::CurrentDirectory = (Get-Location).Path
41-
42-
# Find the specific package version of the SentryModule.cpp file
43-
$sentryModuleCppPath = "package-release-$publishingPlatform/Source/Sentry/Private/SentryModule.cpp"
44-
45-
# We know the file is meant to be UTF8, so let's be explicit
46-
$sentryModuleCppContents = Get-Content $sentryModuleCppPath -Encoding UTF8
47-
$replacedCppContents = $sentryModuleCppContents -replace 'FSentryModule::IsMarketplace = false', 'FSentryModule::IsMarketplace = true'
48-
49-
# PowerShell 5.1 will write UT8-BOM if we use Out-File, so bypass this issue and use ::WriteAllLines
50-
[System.IO.File]::WriteAllLines($sentryModuleCppPath, $replacedCppContents)
51-
}
52-
5335
$pluginSpec = Get-Content "plugin-dev/Sentry.uplugin"
5436
$version = [regex]::Match("$pluginSpec", '"VersionName": "([^"]+)"').Groups[1].Value
5537
$engineVersions = Get-Content $PSScriptRoot/engine-versions.txt

0 commit comments

Comments
 (0)