Skip to content

Commit 5e92f5b

Browse files
authored
fix: Added WebGL pre build process (#2141)
1 parent e1abafe commit 5e92f5b

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
## Unreleased
44

5-
### Fixes
5+
### Fixes
66

7+
- When targeting WebGL with an unsupported configuration (i.e. when the exception support is set to `none`), the SDK now shows an error at build time instead of a runtime failure ([#2141](https://github.com/getsentry/sentry-unity/pull/2141))
8+
- When targeting Desktop Platforms, Sentry-CLI now respects the SDK's debug logging verbosity ([#2138](https://github.com/getsentry/sentry-unity/pull/2138))
79
- When targeting iOS, the SDK now correctly updates the Sentry CLI options used for debug symbol upload when appending builds ([#2146](https://github.com/getsentry/sentry-unity/pull/2146))
810
- When targeting Desktop Platforms, Sentry CLI now respects the SDK's debug logging verbosity ([#2138](https://github.com/getsentry/sentry-unity/pull/2138))
911
- When targeting iOS and setting `IgnoreCliErrors = true`, the Xcode build will now succeed even if the symbol upload itself failed. This is aimed to allow users to unblock themselves ([#2136](https://github.com/getsentry/sentry-unity/pull/2136))
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using Sentry.Extensibility;
2+
using UnityEditor;
3+
using UnityEditor.Build;
4+
using UnityEditor.Build.Reporting;
5+
using UnityEngine;
6+
7+
namespace Sentry.Unity.Editor.WebGL;
8+
9+
internal class BuildPreProcess : IPreprocessBuildWithReport
10+
{
11+
public int callbackOrder => 1;
12+
13+
public void OnPreprocessBuild(BuildReport report)
14+
{
15+
var targetGroup = BuildPipeline.GetBuildTargetGroup(report.summary.platform);
16+
if (targetGroup is not BuildTargetGroup.WebGL)
17+
{
18+
return;
19+
}
20+
21+
if (PlayerSettings.WebGL.exceptionSupport == WebGLExceptionSupport.None)
22+
{
23+
throw new BuildFailedException("WebGL exception support is set to None. The Sentry SDK requires exception " +
24+
"support to function properly. Please change the WebGL exception support setting in Player Settings " +
25+
"or disable the Sentry SDK.");
26+
}
27+
else if (PlayerSettings.WebGL.exceptionSupport != WebGLExceptionSupport.FullWithStacktrace)
28+
{
29+
var (options, _) = SentryScriptableObject.ConfiguredBuildTimeOptions();
30+
var logger = options?.DiagnosticLogger ?? new UnityLogger(options ?? new SentryUnityOptions());
31+
32+
logger.LogWarning("The SDK requires the Exception Support to be set " +
33+
"'WebGLExceptionSupport.FullWithStacktrace' to be able to provide stack traces when " +
34+
"capturing errors.");
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)