A Swift library that wraps the Sentry native SDK
- Build the application with
swift build
- Copy the needed files into the build directory (see copying required files section)
- run
swift run
If you are building inside Arc instead edit Vendor/SwiftSentry.cmake
, comment
out the checkout_git_repo
of SwiftSentry
and add:
set(swiftsentry_SOURCE_DIR /path/to/swift-sentry)
and do a regular Arc build.
- Build the application with
swift build
- Copy the needed files into the build directory (see copying required files section)
- run
swift test
In order to successfully build and deploy this code, you must supply the built artifacts from the sentry-native repository into a folder structure that looks like this:
vendor/
├─ sentry-native/
├─ include/
│ ├─ sentry.h
├─ lib/
│ ├─ macOS/
│ ├─ win64/
│ ├─ linux64/
├─ bin/
│ ├─ win64/
the lib
and bin
folders are platform specific. Depending on which options you choose when compiling the sentry-native repository you will end up with an install folder for a specific platform which includes lib
and bin
, simply copy those items in the structure above.
Due to a limitation of Swift Package Manager you can't copy files from outside of a given target's folder. So we must manually move the required files into the build directory before we execute swift run
. Here are a few examples of how that could look depending on your platform:
- Run
cp vendor\sentry-native\lib\win64\* "$(swift build -c debug --show-bin-path)"
- Run
cp vendor\sentry-native\bin\win64\* "$(swift build -c debug --show-bin-path)"
- Run
cp Examples\SentryExampleWin\Info.plist "$(swift build -c debug --show-bin-path)"
- Run
cp Examples\SentryExampleWin\SentryExampleWin.exe.manifest "$(swift build -c debug --show-bin-path)"
- Run
cp vendor/sentry-native/lib/<platform>/* "$(swift build -c debug --show-bin-path)"
(adjust config as needed for build configuration)
The swift-sentry SDK automatically attempts to look up your release name information. To do this is will read the following keys out of your Info.plist.
CFBundleIdentifier
CFBundleShortVersionString
CFBundleVersion
If you are building a project without an Info.plist
the release value in Sentry will be empty. Setting one is good practice to be able to more easily track your deployments and regressions across time.
- Clone
https://github.com/getsentry/sentry-native
- Run the build command
- On Windows you will need to run something like
cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION="10.0.19041.0"
as it seems that sometimes the right target platform version isn't picked up which will turn off WER support. - On macOS you can simply run
cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
- On Windows you will need to run something like
- Run
cmake --build build --parallel --config RelWithDebInfo
to actually build the project - Run
cmake --install build --prefix install --config RelWithDebInfo
to copy the built products into theinstall
directory within sentry-native - Copy the contents of the
install
directory into yourvendor/sentry-native
folder in the required structure as outlined in the artifacts section.
This library is still very much a work in progress, but basic functional testing has been preformed on the following platforms:
- Windows 11 Pro (
x86_64
-only) - macOS 14.0 (
ARM
-only)