-
Notifications
You must be signed in to change notification settings - Fork 35
Migrate Unity iOS/macOS native integration #256
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
base: master
Are you sure you want to change the base?
Conversation
{ | ||
if (buildTarget != BuildTarget.iOS) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad formatting
#if UNITY_2019_3_OR_NEWER | ||
string appTargetGuid = project.GetUnityMainTargetGuid(); | ||
string unityFrameworkTargetGuid = project.GetUnityFrameworkTargetGuid(); | ||
#else | ||
string appTargetGuid = project.TargetGuidByName("Unity-iPhone"); | ||
string unityFrameworkTargetGuid = appTargetGuid; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit:
what do you think about?
#if UNITY_2019_3_OR_NEWER | |
string appTargetGuid = project.GetUnityMainTargetGuid(); | |
string unityFrameworkTargetGuid = project.GetUnityFrameworkTargetGuid(); | |
#else | |
string appTargetGuid = project.TargetGuidByName("Unity-iPhone"); | |
string unityFrameworkTargetGuid = appTargetGuid; | |
#endif | |
string appTargetGuid = | |
#if UNITY_2019_3_OR_NEWER | |
project.GetUnityMainTargetGuid(); | |
#else | |
project.TargetGuidByName("Unity-iPhone"); | |
#endif | |
string unityFrameworkTargetGuid = | |
#if UNITY_2019_3_OR_NEWER | |
project.GetUnityFrameworkTargetGuid(); | |
#else | |
appTargetGuid; | |
#endif |
} | ||
|
||
// Locate exported xcframeworks | ||
string FindXCFramework(string folderName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move it to class instance? It's not popular in C# to have a function declaration inside another function. its also inconsistent with the rest of the library code
var backtraceXCPath = FindXCFramework("Backtrace.xcframework"); | ||
var crashReporterXCPath = FindXCFramework("CrashReporter.xcframework"); | ||
|
||
if (string.IsNullOrEmpty(backtraceXCPath)) | ||
{ | ||
Debug.LogError($"[Backtrace] Could not locate Backtrace.xcframework under: {buildPath}"); | ||
return; | ||
} | ||
if (string.IsNullOrEmpty(crashReporterXCPath)) | ||
{ | ||
Debug.LogError($"[Backtrace] Could not locate CrashReporter.xcframework under: {buildPath}"); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nit:
var backtraceXCPath = FindXCFramework("Backtrace.xcframework"); | |
var crashReporterXCPath = FindXCFramework("CrashReporter.xcframework"); | |
if (string.IsNullOrEmpty(backtraceXCPath)) | |
{ | |
Debug.LogError($"[Backtrace] Could not locate Backtrace.xcframework under: {buildPath}"); | |
return; | |
} | |
if (string.IsNullOrEmpty(crashReporterXCPath)) | |
{ | |
Debug.LogError($"[Backtrace] Could not locate CrashReporter.xcframework under: {buildPath}"); | |
return; | |
} | |
var backtraceXCPath = FindXCFramework("Backtrace.xcframework"); | |
if (string.IsNullOrEmpty(backtraceXCPath)) | |
{ | |
Debug.LogError($"[Backtrace] Could not locate Backtrace.xcframework under: {buildPath}"); | |
return; | |
} | |
var crashReporterXCPath = FindXCFramework("CrashReporter.xcframework"); | |
if (string.IsNullOrEmpty(crashReporterXCPath)) | |
{ | |
Debug.LogError($"[Backtrace] Could not locate CrashReporter.xcframework under: {buildPath}"); | |
return; | |
} |
string relCrashReporterXC = ToProjectRelative(buildPath, crashReporterXCPath); | ||
|
||
// Add file references | ||
string backtraceFileGuid = project.FindFileGuidByProjectPath(relBacktraceXC); | ||
if (string.IsNullOrEmpty(backtraceFileGuid)) { | ||
backtraceFileGuid = project.AddFile(relBacktraceXC, relBacktraceXC, PBXSourceTree.Source); | ||
} | ||
|
||
string crashReporterFileGuid = project.FindFileGuidByProjectPath(relCrashReporterXC); | ||
if (string.IsNullOrEmpty(crashReporterFileGuid)) { | ||
crashReporterFileGuid = project.AddFile(relCrashReporterXC, relCrashReporterXC, PBXSourceTree.Source); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nit:
string relCrashReporterXC = ToProjectRelative(buildPath, crashReporterXCPath); | |
// Add file references | |
string backtraceFileGuid = project.FindFileGuidByProjectPath(relBacktraceXC); | |
if (string.IsNullOrEmpty(backtraceFileGuid)) { | |
backtraceFileGuid = project.AddFile(relBacktraceXC, relBacktraceXC, PBXSourceTree.Source); | |
} | |
string crashReporterFileGuid = project.FindFileGuidByProjectPath(relCrashReporterXC); | |
if (string.IsNullOrEmpty(crashReporterFileGuid)) { | |
crashReporterFileGuid = project.AddFile(relCrashReporterXC, relCrashReporterXC, PBXSourceTree.Source); | |
} | |
// Add file references | |
var backtraceFileGuid = project.FindFileGuidByProjectPath(relBacktraceXC); | |
if (string.IsNullOrEmpty(backtraceFileGuid)) { | |
backtraceFileGuid = project.AddFile(relBacktraceXC, relBacktraceXC, PBXSourceTree.Source); | |
} | |
var relCrashReporterXC = ToProjectRelative(buildPath, crashReporterXCPath); | |
var crashReporterFileGuid = project.FindFileGuidByProjectPath(relCrashReporterXC); | |
if (string.IsNullOrEmpty(crashReporterFileGuid)) { | |
crashReporterFileGuid = project.AddFile(relCrashReporterXC, relCrashReporterXC, PBXSourceTree.Source); | |
} |
Changes summary
This PR migrates the Unity native integration from the legacy cocoa static libraries to dynamic backtrace-cocoa frameworks:
The public C# API remains unchanged, only NativeClient and build steps are updated.
Why this change
Footprint
Sample Reports
What's next