Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/mac support #225

Merged
merged 8 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
2 changes: 1 addition & 1 deletion Editor/BacktraceClientConfigurationEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public override void OnInspectorGUI()
#else
settings.IgnoreSslValidation = false;
#endif
#if UNITY_ANDROID || UNITY_IOS
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX
settings.HandleANR = EditorGUILayout.Toggle(BacktraceConfigurationLabels.LABEL_HANDLE_ANR, settings.HandleANR);
settings.OomReports = EditorGUILayout.Toggle(BacktraceConfigurationLabels.LABEL_HANDLE_OOM, settings.OomReports);
#endif
Expand Down
4 changes: 2 additions & 2 deletions Editor/BacktraceConfigurationEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public override void OnInspectorGUI()
#endif


#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_WIN || UNITY_GAMECORE_XBOXSERIES
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_WIN || UNITY_GAMECORE_XBOXSERIES || UNITY_STANDALONE_OSX
SerializedProperty captureNativeCrashes = serializedObject.FindProperty("CaptureNativeCrashes");
EditorGUILayout.PropertyField(
captureNativeCrashes,
Expand All @@ -153,7 +153,7 @@ public override void OnInspectorGUI()
serializedObject.FindProperty("HandleANR"),
new GUIContent(BacktraceConfigurationLabels.LABEL_HANDLE_ANR));
#endif
#if UNITY_ANDROID || UNITY_IOS
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX
EditorGUILayout.PropertyField(
serializedObject.FindProperty("OomReports"),
new GUIContent(BacktraceConfigurationLabels.LABEL_HANDLE_OOM));
Expand Down
8 changes: 8 additions & 0 deletions Mac.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 74 additions & 0 deletions Mac/Backtrace-Unity-Mac-bundle.bundle.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions Mac/Backtrace-Unity-Mac-bundle.bundle/Contents/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>23F79</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>Backtrace-Unity-Mac-bundle</string>
<key>CFBundleIdentifier</key>
<string>Backtrace.Backtrace-Unity-Mac-bundle</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Backtrace-Unity-Mac-bundle</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string></string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>14.5</string>
<key>DTSDKBuild</key>
<string>23F73</string>
<key>DTSDKName</key>
<string>macosx14.5</string>
<key>DTXcode</key>
<string>1540</string>
<key>DTXcodeBuild</key>
<string>15F31d</string>
<key>LSMinimumSystemVersion</key>
<string>12.3</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2024 Backtrace. All rights reserved.</string>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict/>
<key>files2</key>
<dict/>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>
6 changes: 3 additions & 3 deletions Runtime/BacktraceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ private void OnDestroy()
_instance = null;
Application.logMessageReceived -= HandleUnityMessage;
Application.logMessageReceivedThreaded -= HandleUnityBackgroundException;
#if UNITY_ANDROID || UNITY_IOS
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX
Application.lowMemory -= HandleLowMemory;
#endif
if (_nativeClient != null)
Expand Down Expand Up @@ -1040,7 +1040,7 @@ private void CaptureUnityMessages()
{
Application.logMessageReceived += HandleUnityMessage;
Application.logMessageReceivedThreaded += HandleUnityBackgroundException;
#if UNITY_ANDROID || UNITY_IOS
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX
Application.lowMemory += HandleLowMemory;
#endif
}
Expand Down Expand Up @@ -1069,7 +1069,7 @@ internal void HandleUnityBackgroundException(string message, string stackTrace,
HandleUnityMessage(message, stackTrace, type);
}

#if UNITY_ANDROID || UNITY_IOS
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX
internal void HandleLowMemory()
{
if (!Enabled)
Expand Down
4 changes: 4 additions & 0 deletions Runtime/Model/Attributes/MachineAttributeProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ private void IncludeOsInformation(IDictionary<string, string> attributes)
attributes["uname.version"] = UnityEngine.iOS.Device.systemVersion;
attributes["uname.fullname"] = Environment.OSVersion.Version.ToString();
#endif

Copy link
Collaborator

Choose a reason for hiding this comment

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

why we cannot use the if statement above ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

UnityEngine.iOS.Device.systemVersion is iOS specific

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah but in talking about environment.osversion

#if UNITY_STANDALONE_OSX && !UNITY_EDITOR
attributes["uname.fullname"] = Environment.OSVersion.Version.ToString();
#endif
}

private void IncludeGraphicCardInformation(IDictionary<string, string> attributes)
Expand Down
8 changes: 4 additions & 4 deletions Runtime/Model/BacktraceConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public class BacktraceConfiguration : ScriptableObject
/// <summary>
/// Handle ANR events - Application not responding
/// </summary>
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_WIN
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
[Tooltip("Capture ANR events - Application not responding")]
#else
[Obsolete("Not supported")]
Expand All @@ -157,7 +157,7 @@ public class BacktraceConfiguration : ScriptableObject
/// <summary>
/// Anr watchdog timeout in ms. Time needed to detect an ANR event
/// </summary>
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_WIN
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
[Tooltip("ANR watchdog timeout")]
#else
[Obsolete("Not supported")]
Expand All @@ -167,7 +167,7 @@ public class BacktraceConfiguration : ScriptableObject
/// <summary>
/// Send Out of memory exceptions to Backtrace.
/// </summary>
#if UNITY_ANDROID || UNITY_IOS
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX
[Tooltip("Send Out of Memory exceptions to Backtrace")]
#else
[Obsolete("Not supported")]
Expand All @@ -177,7 +177,7 @@ public class BacktraceConfiguration : ScriptableObject
/// <summary>
/// Enable client side unwinding.
/// </summary>
#if UNITY_2019_2_OR_NEWER && (UNITY_ANDROID || UNITY_IOS)
#if UNITY_2019_2_OR_NEWER && (UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX)
[Tooltip("Enable client-side unwinding.")]
#else
[Obsolete("Not supported")]
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Native/Base/NativeClientBase.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_WIN || UNITY_GAMECORE_XBOXSERIES
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_WIN || UNITY_GAMECORE_XBOXSERIES || UNITY_STANDALONE_OSX
using Backtrace.Unity.Model;
using Backtrace.Unity.Model.Breadcrumbs;
using Backtrace.Unity.Extensions;
Expand Down
8 changes: 8 additions & 0 deletions Runtime/Native/Mac.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Runtime/Native/NativeClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ internal static INativeClient CreateNativeClient(BacktraceConfiguration configur
return new Android.NativeClient(configuration, breadcrumbs, attributes, attachments, gameObjectName);
#elif UNITY_IOS
return new iOS.NativeClient(configuration, breadcrumbs, attributes, attachments);
#elif UNITY_STANDALONE_OSX
return new OSX.NativeClient(configuration, breadcrumbs, attributes, attachments);
#else
return null;
#endif
Expand Down
8 changes: 8 additions & 0 deletions Runtime/Native/OSX.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading