Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1d9458f
wip
armcknight Apr 9, 2025
5cb4310
more wip
armcknight Apr 9, 2025
968a066
implement display
armcknight Apr 9, 2025
98bcbf2
fix ui tests; tweak api
armcknight Apr 11, 2025
5824325
fix build on older xcodes
armcknight Apr 11, 2025
8b97b5c
missed negating a couple "disable" overrides
armcknight Apr 11, 2025
ebb7900
add missing launch arg for file manager swizzling; helps with downstr…
armcknight Apr 12, 2025
f2b7c97
put back schema config
armcknight Apr 12, 2025
81711c8
ref: create shared lib for sample apps
armcknight Apr 9, 2025
3263cc3
ref: create shared lib for sample apps
armcknight Apr 9, 2025
648adf5
use in iOS13-Swift
armcknight Apr 9, 2025
968fc41
use in iOS-SwiftUI
armcknight Apr 9, 2025
078639a
use in iOS15-SwiftUI
armcknight Apr 9, 2025
fdcf250
xcode insists on making this change automatically
armcknight Apr 9, 2025
dd4c4cb
add to iOS-Swift6 and fix a couple build errors after rebasing to get…
armcknight Apr 10, 2025
4c5f7bd
add to iOS-Swift6 and fix a couple build errors after rebasing to get…
armcknight Apr 10, 2025
783f991
use the sdk wrapper in the swift clip too
armcknight Apr 10, 2025
cde3037
Merge branch 'main' into armcknight/test/more-feature-flags
armcknight Apr 16, 2025
3484255
Merge branch 'armcknight/test/more-feature-flags' into armcknight/tes…
armcknight Apr 16, 2025
e33dd2d
use shared wrapper in session replay camera test app
armcknight Apr 17, 2025
700ac6c
meta: update clang-format
armcknight Apr 17, 2025
b365843
Merge branch 'armcknight/meta/update-clang-format' into armcknight/te…
armcknight Apr 17, 2025
379ace1
Merge branch 'armcknight/test/more-feature-flags' into armcknight/tes…
armcknight Apr 17, 2025
c2a3e04
xcode automatic addition of product
armcknight Apr 17, 2025
fe77ca7
fix double ref
armcknight Apr 17, 2025
b1e0a3a
fix objectVersion compatibility
armcknight Apr 17, 2025
1b18905
add test/testci build configs to shared lib target; sentry project de…
armcknight Apr 17, 2025
296bdc0
remove old project of same name
armcknight Apr 17, 2025
f2eb91d
remove logging added to sdk for separate PR
armcknight Apr 17, 2025
10aec26
use more descriptive fatalError messages
armcknight Apr 17, 2025
8eaa834
Merge branch 'armcknight/test/more-feature-flags' into armcknight/tes…
armcknight Apr 17, 2025
74251ff
try overwriting all objectVersion numbers to the earliest one that or…
armcknight Apr 17, 2025
bf9f573
Merge branch 'main' into armcknight/test/share-sdk-wrapper
armcknight Apr 17, 2025
93b01e6
make a couple more easy moves to the shared wrapper
armcknight Apr 17, 2025
f1f54b0
fixup! try overwriting all objectVersion numbers to the earliest one …
armcknight Apr 17, 2025
89cc935
ci: use latest macos with default xcode to build sample apps
armcknight Apr 17, 2025
4f477de
ci: dont specify a default xcode value inside the script
armcknight Apr 17, 2025
15cec74
use macos-15
armcknight Apr 17, 2025
461996a
also for iOS-Swift; remove the step that just lists schemes
armcknight Apr 17, 2025
7f23c6d
Merge branch 'armcknight/ci/build-sample-apps-on-latest' into armckni…
armcknight Apr 17, 2025
ab52504
Revert "fixup! try overwriting all objectVersion numbers to the earli…
armcknight Apr 17, 2025
2609676
Revert "try overwriting all objectVersion numbers to the earliest one…
armcknight Apr 17, 2025
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
35 changes: 5 additions & 30 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
# With this we catch potential issues already in the PR.
ios-swift-release:
name: Release Build of iOS Swift
runs-on: macos-14
runs-on: macos15
steps:
- uses: actions/checkout@v4
- run: ./scripts/ci-select-xcode.sh 16.2
- run: ./scripts/ci-select-xcode.sh 16.3
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
Expand All @@ -50,47 +50,22 @@ jobs:

build-sample:
name: Sample ${{ matrix.scheme }}
runs-on: ${{ matrix.runs-on }}
runs-on: macos-15
strategy:
fail-fast: false
matrix:
# other sample projects are built in ui-tests
include:
- scheme: macOS-Swift
xcode: 15.4
runs-on: macos-14
- scheme: iOS13-Swift
xcode: 15.4
runs-on: macos-14
- scheme: watchOS-Swift WatchKit App
xcode: 15.4
runs-on: macos-14
# Only compiles on Xcode 16+
- scheme: macOS-SwiftUI
xcode: 16.2
runs-on: macos-15

- scheme: SessionReplay-CameraTest
xcode: 16.2
runs-on: macos-15

# We have to compile on Xcode 16.3 because compiling on Xcode 16.2 fails with
# Data+SentryTracing.swift:21:62: error: 'ReadingOptions' aliases 'Foundation.ReadingOptions'
# and cannot be used here because C++ types from imported module 'Foundation' do not support
# library evolution; this is an error in the Swift 6 language mode
- scheme: visionOS-Swift
xcode: 16.3
runs-on: macos-15

steps:
- uses: actions/checkout@v4
- run: ./scripts/ci-select-xcode.sh ${{ matrix.xcode }}

- name: List Xcode Build Schemes
run: >-
xcodebuild
-workspace Sentry.xcworkspace
-list
- run: ./scripts/ci-select-xcode.sh 16.3

# Note: Due to complexity in implementing the CODE_SIGNING_ALLOWED flag in the sentry-xcodebuild.sh script,
# we did not yet migrate this step to use the script yet.
Expand All @@ -107,7 +82,7 @@ jobs:
uses: actions/upload-artifact@v4
if: ${{ failure() || cancelled() }}
with:
name: raw-build-output-os-${{matrix.runs-on}}-xcode-${{matrix.xcode}}-scheme-${{matrix.scheme}}
name: raw-build-output-scheme-${{matrix.scheme}}
path: |
raw-build-output.log

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,4 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
*xcshareddata
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import Sentry
/**
* Stores the DSN to a file in the cache directory.
*/
class DSNStorage {

static let shared = DSNStorage()

public class DSNStorage {
public static let shared = DSNStorage()

private let dsnFile: URL

private init() {
Expand All @@ -17,12 +16,12 @@ class DSNStorage {
dsnFile = cachesDirectory.appendingPathComponent("dsn")
}

func saveDSN(dsn: String) throws {
public func saveDSN(dsn: String) throws {
try deleteDSN()
try dsn.write(to: dsnFile, atomically: true, encoding: .utf8)
}

func getDSN() throws -> String? {
public func getDSN() throws -> String? {
let fileManager = FileManager.default

guard fileManager.fileExists(atPath: dsnFile.path) else {
Expand All @@ -32,7 +31,7 @@ class DSNStorage {
return try String(contentsOfFile: dsnFile.path)
}

func deleteDSN() throws {
public func deleteDSN() throws {
let fileManager = FileManager.default
if fileManager.fileExists(atPath: dsnFile.path) {
try fileManager.removeItem(at: dsnFile)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
import Sentry

extension Span {
public extension Span {

//If span is a transaction it has a list of children
func children() -> [Span]? {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
import UIKit

extension UIView {
public extension UIView {
/// A shortcut to disable `translatesAutoresizingMaskIntoConstraints`
/// - Returns: self
func forAutoLayout() -> Self {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import Foundation
import Sentry

extension Bundle {
var gitCommitHash: String? {
infoDictionary?["GIT_COMMIT_HASH"] as? String
}
var gitBranchName: String? {
infoDictionary?["GIT_BRANCH"] as? String
}
var gitStatusClean: Bool {
(infoDictionary?["GIT_STATUS_CLEAN"] as? String) == "1"
}
}

public func injectGitInformation(scope: Scope) {
if let commitHash = Bundle.main.gitCommitHash {
scope.setTag(value: "\(commitHash)\(Bundle.main.gitStatusClean ? "" : "-dirty")", key: "git-commit-hash")
}
if let branchName = Bundle.main.gitBranchName {
scope.setTag(value: branchName, key: "git-branch-name")
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

protocol SentrySDKOverride: RawRepresentable, CaseIterable {
public protocol SentrySDKOverride: RawRepresentable, CaseIterable {
var boolValue: Bool { get set }
var floatValue: Float? { get set }
var stringValue: String? { get set }
Expand Down Expand Up @@ -30,7 +30,7 @@ public enum SentrySDKOverrides {
}
}

enum Special: String, SentrySDKOverride {
public enum Special: String, SentrySDKOverride {
case wipeDataOnLaunch = "--io.sentry.wipe-data"
case disableEverything = "--io.sentry.disable-everything"

Expand All @@ -44,7 +44,7 @@ public enum SentrySDKOverrides {
}
}

enum Feedback: String, SentrySDKOverride {
public enum Feedback: String, SentrySDKOverride {
case allDefaults = "--io.sentry.feedback.all-defaults"
case disableAutoInject = "--io.sentry.feedback.no-auto-inject-widget"
case noWidgetText = "--io.sentry.feedback.no-widget-text"
Expand All @@ -67,7 +67,7 @@ public enum SentrySDKOverrides {
}
}

enum Performance: String, SentrySDKOverride {
public enum Performance: String, SentrySDKOverride {
case disableTimeToFullDisplayTracing = "--disable-time-to-full-display-tracing"
case disablePerformanceV2 = "--disable-performance-v2"
case disableAppHangTrackingV2 = "--disable-app-hang-tracking-v2"
Expand All @@ -92,7 +92,7 @@ public enum SentrySDKOverrides {
}
}

enum Other: String, SentrySDKOverride {
public enum Other: String, SentrySDKOverride {
case disableAttachScreenshot = "--disable-attach-screenshot"
case disableAttachViewHierarchy = "--disable-attach-view-hierarchy"
case disableSessionReplay = "--disable-session-replay"
Expand All @@ -118,7 +118,7 @@ public enum SentrySDKOverrides {
}
}

var stringValue: String? {
public var stringValue: String? {
get {
switch self {
case .userName, .userEmail: return getStringValueOverride(for: rawValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,31 @@
import Sentry
import UIKit

struct SentrySDKWrapper {
static let shared = SentrySDKWrapper()
func startSentry() {
public struct SentrySDKWrapper {
public static let shared = SentrySDKWrapper()

public func startSentry() {
SentrySDK.start(configureOptions: configureSentryOptions(options:))
}

func configureSentryOptions(options: Options) {
options.dsn = dsn
options.beforeSend = { $0 }
options.beforeSendSpan = { $0 }
options.beforeCaptureScreenshot = { _ in true }
options.beforeCaptureViewHierarchy = { _ in true }
options.beforeSend = {
print("Sentry: beforeSend called")
return $0
}
options.beforeSendSpan = {
print("Sentry: beforeSendSpan called")
return $0
}
options.beforeCaptureScreenshot = { _ in
print("Sentry: beforeCaptureScreenshot called")
return true
}
options.beforeCaptureViewHierarchy = { _ in
print("Sentry: beforeCaptureViewHierarchy called")
return true
}
options.debug = true

if #available(iOS 16.0, *), !SentrySDKOverrides.Other.disableSessionReplay.boolValue {
Expand Down Expand Up @@ -118,9 +130,9 @@ struct SentrySDKWrapper {
}

scope.setTag(value: "swift", key: "language")
scope.injectGitInformation()

injectGitInformation(scope: scope)

let user = User(userId: "1")
user.email = self.env["--io.sentry.user.email"] ?? "tony@example.com"
user.username = username
Expand Down Expand Up @@ -339,8 +351,8 @@ extension SentrySDKWrapper {

// MARK: Convenience access to SDK configuration via launch arg / environment variable
extension SentrySDKWrapper {
static let defaultDSN = "https://6cc9bae94def43cab8444a99e0031c28@o447951.ingest.sentry.io/5428557"
public static let defaultDSN = "https://6cc9bae94def43cab8444a99e0031c28@o447951.ingest.sentry.io/5428557"

var args: [String] {
let args = ProcessInfo.processInfo.arguments
print("[iOS-Swift] [debug] launch arguments: \(args)")
Expand Down
Loading
Loading