Giter VIP home page Giter VIP logo

swift-sentry's Introduction

swift-sentry

A Swift library that wraps the Sentry native SDK

Setup

  1. Build the application with swift build
  2. Copy the needed files into the build directory (see copying required files section)
  3. run swift run

Requirements

Sentry Native Artifacts

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/
├─ 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.

Copying Required Files

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:

Windows

  1. Run cp vendor\sentry-native\lib\win64\* "$(swift build -c debug --show-bin-path)"
  2. Run cp vendor\sentry-native\bin\win64\* "$(swift build -c debug --show-bin-path)"
  3. Run cp Examples\SentryExampleWin\Info.plist "$(swift build -c debug --show-bin-path)"
  4. Run cp Examples\SentryExampleWin\SentryExampleWin.exe.manifest "$(swift build -c debug --show-bin-path)"

macOS / Linux

  1. Run cp vendor/sentry-native/lib/<platform>/* "$(swift build -c debug --show-bin-path)" (adjust config as needed for build configuration)

Sentry Release Naming

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.

Producing Artifacts From The Sentry Native Repo

  1. Clone https://github.com/getsentry/sentry-native
  2. 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
  3. Run cmake --build build --parallel --config RelWithDebInfo to actually build the project
  4. Run cmake --install build --prefix install --config RelWithDebInfo to copy the built products into the install directory within sentry-native
  5. Copy the contents of the install directory into your vendor/sentry-native folder in the required structure as outlined in the artifacts section.

Supported Platforms

This library is still very much a work in progress, but basic functional testing has been preformed on the following platforms:

  • Window 11 Pro (x86_64-only)
  • macOS 14.0 (ARM-only)

swift-sentry's People

Contributors

brianmichel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.