Skip to content
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
11 changes: 7 additions & 4 deletions plugin-dev/Sentry.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"PreBuildSteps":
{
"Mac": [
"if [ -f \"$(PluginDir)/Scripts/upload-debug-symbols.sh\" ]; then\n chmod +x \"$(PluginDir)/Scripts/upload-debug-symbols.sh\" \nfi"
"if [ -f \"$(PluginDir)/Scripts/upload-debug-symbols.sh\" ]; then\n chmod +x \"$(PluginDir)/Scripts/upload-debug-symbols.sh\" \nfi",
"if [ -f \"$(PluginDir)/Source/ThirdParty/CLI/sentry-cli-Darwin-universal\" ]; then\n chmod +x \"$(PluginDir)/Source/ThirdParty/CLI/sentry-cli-Darwin-universal\" \nfi"
]
},
"PostBuildSteps":
Expand All @@ -44,9 +45,11 @@
"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"
],
"Win64": [
"setlocal enabledelayedexpansion",
"set \"CRASHPAD_HANDLER=$(PluginDir)/Binaries/Linux/crashpad_handler\"",
"if \"$(TargetPlatform)\"==\"Linux\" (\n if not exist \"%CRASHPAD_HANDLER%\" (xcopy \"$(PluginDir)/Source/ThirdParty/Linux/bin/*\" \"$(PluginDir)/Binaries/Linux/\" /F /R /Y /I)\n)",
"setlocal enabledelayedexpansion",
"set \"CRASHPAD_HANDLER_LINUX=$(PluginDir)/Binaries/Linux/crashpad_handler\"",
"if \"$(TargetPlatform)\"==\"Linux\" (\n if not exist \"%CRASHPAD_HANDLER_LINUX%\" (xcopy \"$(PluginDir)/Source/ThirdParty/Linux/bin/*\" \"$(PluginDir)/Binaries/Linux/\" /F /R /Y /I)\n)",
"set \"CRASHPAD_HANDLER_WIN=$(PluginDir)/Binaries/Win64/crashpad_handler.exe\"",
"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)",
"set \"SYM_UPLOAD_SCRIPT=$(PluginDir)/Scripts/upload-debug-symbols-win.bat\"",
"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)",
"endlocal"
Expand Down
13 changes: 10 additions & 3 deletions plugin-dev/Source/Sentry/Private/SentryModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

const FName FSentryModule::ModuleName = "Sentry";

const bool FSentryModule::IsMarketplace = false;

void FSentryModule::StartupModule()
{
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
Expand Down Expand Up @@ -117,7 +115,16 @@ FString FSentryModule::GetPluginVersion()

bool FSentryModule::IsMarketplaceVersion()
{
return IsMarketplace;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was IsMarketplace left unused? should it be removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I believe it can be safely removed.

Additional context: IsMarketplace value was set by CI script depending on plugin package type (see 5ef0806)

// Marketplace version check heuristic:
// In case the plugin installed via Epic Games launcher path to its base dir supposed to be <EngineDir>/Plugins/Marketplace/Sentry
// This approach is not foolproof as users may manually copy plugin to this location

const FString PluginPath = FPaths::ConvertRelativePathToFull(
IPluginManager::Get().FindPlugin(TEXT("Sentry"))->GetBaseDir());
const FString MarketplacePrefix = FPaths::ConvertRelativePathToFull(
FPaths::Combine(FPaths::EnginePluginsDir(), TEXT("Marketplace")));

return PluginPath.StartsWith(MarketplacePrefix);
}

#if PLATFORM_MAC
Expand Down
18 changes: 0 additions & 18 deletions scripts/packaging/pack.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,6 @@ function packFiles([string] $publishingPlatform)
Copy-Item "CHANGELOG.md" -Destination "package-release-$publishingPlatform/CHANGELOG.md"
Copy-Item "LICENSE" -Destination "package-release-$publishingPlatform/LICENSE"

if ($publishingPlatform -eq "marketplace")
{
# Workaround for PowerShell 5.1 writing UTF8-BOM
# ======
# Set current directory so that ::WriteAllLines can accept a relative path
[System.Environment]::CurrentDirectory = (Get-Location).Path

# Find the specific package version of the SentryModule.cpp file
$sentryModuleCppPath = "package-release-$publishingPlatform/Source/Sentry/Private/SentryModule.cpp"

# We know the file is meant to be UTF8, so let's be explicit
$sentryModuleCppContents = Get-Content $sentryModuleCppPath -Encoding UTF8
$replacedCppContents = $sentryModuleCppContents -replace 'FSentryModule::IsMarketplace = false', 'FSentryModule::IsMarketplace = true'

# PowerShell 5.1 will write UT8-BOM if we use Out-File, so bypass this issue and use ::WriteAllLines
[System.IO.File]::WriteAllLines($sentryModuleCppPath, $replacedCppContents)
}

$pluginSpec = Get-Content "plugin-dev/Sentry.uplugin"
$version = [regex]::Match("$pluginSpec", '"VersionName": "([^"]+)"').Groups[1].Value
$engineVersions = Get-Content $PSScriptRoot/engine-versions.txt
Expand Down
Loading