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

[PLAT-6281] Remove reliance on AppKit to allow use in daemons #1072

Merged
merged 2 commits into from
Apr 14, 2021

Conversation

nickdowell
Copy link
Contributor

@nickdowell nickdowell commented Apr 14, 2021

Goal

Allows Bugsnag to be used in macOS executables without linking AppKit.

This matters because some frameworks, such as AppKit, are not safe to use in daemons or executables that run in a non-UI session (bootstrap namespace) as documented in  Technical Note TN2083: Daemons and Agents.

Design

See #919

Changeset

  • CLANG_MODULES_AUTOLINK has been set to NO for Bugsnag-macOS in the top-level Bugsnag project - this will cause a build failure if we reintroduce a link-time dependency on AppKit e.g. Undefined symbol: _OBJC_CLASS_$_NSApplication
  • Messages to AppKit classes now use NSClassFromString() (via macros) to avoid linking against the class symbol
  • Notification names are now hardcoded
  • NSProcessInfo.processInfo.processName is now used if NSBundle.mainBundle.bundleIdentifier is nil to prevent ~/Library/Application Support/com.bugsnag.Bugsnag/(null) being used as the storage location for executables that have no Info.plist.

Testing

  • Added a unit test case to verify that the hard-coded notification names match those used by the OS.
  • Manually verified that Bugsnag works when used in an executable that has no CFBundleIdentifier

@github-actions
Copy link

Infer: No issues found 🎉

OCLint: No issues found 🎉

Bugsnag.framework binary size did not change - 1,119,520 bytes

Generated by 🚫 Danger

@nickdowell nickdowell merged commit 3904050 into next Apr 14, 2021
@nickdowell nickdowell deleted the nickdowell/without-appkit branch April 14, 2021 14:42
@nickdowell nickdowell mentioned this pull request Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants