Skip to content

Commit

Permalink
Merge branch 'main' into feat/api-manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
brustolin authored Aug 16, 2023
2 parents 9f3a8f3 + 329dd0d commit e9966d7
Show file tree
Hide file tree
Showing 41 changed files with 527 additions and 310 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@

- Add required reason API (#3206)

## 8.9.6

### Fixed

- WatchOS build for Xcode 15 (#3204)
- Fix CPU usage collection for upcoming visualization in profiling flamecharts (#3214)

## 8.9.5

### Hybrid SDK support

- Allow profiling from hybrid SDKs (([#3194]https://github.com/getsentry/sentry-cocoa/pull/3194))

## 8.9.4

### Fixes
Expand Down
8 changes: 4 additions & 4 deletions Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 8.9.4;
MARKETING_VERSION = 8.9.6;
PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.sample.iOS-Swift";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "match Development io.sentry.sample.iOS-Swift";
Expand Down Expand Up @@ -1225,7 +1225,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 8.9.4;
MARKETING_VERSION = 8.9.6;
PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.sample.iOS-Swift";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "match AppStore io.sentry.sample.iOS-Swift";
Expand Down Expand Up @@ -1870,7 +1870,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 8.9.4;
MARKETING_VERSION = 8.9.6;
PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.sample.iOS-Swift.Clip";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "match Development io.sentry.sample.iOS-Swift.Clip";
Expand Down Expand Up @@ -1905,7 +1905,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 8.9.4;
MARKETING_VERSION = 8.9.6;
PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.sample.iOS-Swift.Clip";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "match AppStore io.sentry.sample.iOS-Swift.Clip";
Expand Down
93 changes: 58 additions & 35 deletions Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ class ExtraViewController: UIViewController {
AppDelegate.startSentry()
}

@IBAction func causeFrozenFrames(_ sender: Any) {
var a = String()
for i in 0..<100_000_000 {
a.append(String(i))
}
}

private func calcPi() -> Double {
var denominator = 1.0
var pi = 0.0
Expand Down
69 changes: 62 additions & 7 deletions Samples/iOS-Swift/iOS-Swift/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ class ViewController: UIViewController {
dataTask.resume()
}

var span: Span?
var spans = [Span]()
let profilerNotification = NSNotification.Name("SentryProfileCompleteNotification")

@IBAction func startTransaction(_ sender: UIButton) {
highlightButton(sender)
guard span == nil else { return }
span = SentrySDK.startTransaction(name: "Manual Transaction", operation: "Manual Operation")
startNewTransaction()
}

fileprivate func startNewTransaction() {
spans.append(SentrySDK.startTransaction(name: "Manual Transaction", operation: "Manual Operation"))

NotificationCenter.default.addObserver(forName: profilerNotification, object: nil, queue: nil) { note in
DispatchQueue.main.async {
Expand All @@ -49,12 +52,64 @@ class ViewController: UIViewController {
}
}

@IBAction func startTransactionFromOtherThread(_ sender: UIButton) {
highlightButton(sender)

Thread.detachNewThread {
self.startNewTransaction()
}
}

@IBAction func stopTransaction(_ sender: UIButton) {
highlightButton(sender)
span?.finish()
span = nil

NotificationCenter.default.removeObserver(self, name: profilerNotification, object: nil)
defer {
if spans.isEmpty {
NotificationCenter.default.removeObserver(self, name: profilerNotification, object: nil)
}
}

func showConfirmation(span: Span) {
DispatchQueue.main.async {
let confirmation = UIAlertController(title: "Finished span \(span.spanId.sentrySpanIdString)", message: nil, preferredStyle: .alert)
confirmation.addAction(UIAlertAction(title: "OK", style: .default))
self.present(confirmation, animated: true)
}
}

func finishSpan(span: Span) {
span.finish()
self.spans.remove(at: self.spans.firstIndex(where: { testSpan in
testSpan.spanId == span.spanId
})!)
showConfirmation(span: span)
}

if spans.count == 1 {
finishSpan(span: spans[0])
return
}

let alert = UIAlertController(title: "Choose span to stop", message: nil, preferredStyle: .actionSheet)
spans.forEach { span in
alert.addAction(UIAlertAction(title: span.spanId.sentrySpanIdString, style: .default, handler: { _ in
let threadPicker = UIAlertController(title: "From thread:", message: nil, preferredStyle: .actionSheet)
threadPicker.addAction(UIAlertAction(title: "Main thread", style: .default, handler: { _ in
DispatchQueue.main.async {
finishSpan(span: span)
}
}))
threadPicker.addAction(UIAlertAction(title: "BG thread", style: .default, handler: { _ in
Thread.detachNewThread {
finishSpan(span: span)
}
}))
threadPicker.addAction(UIAlertAction(title: "Cancel", style: .cancel))
self.present(threadPicker, animated: true)
}))
}
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel))
present(alert, animated: true)
}

@IBAction func captureTransaction(_ sender: UIButton) {
Expand Down
2 changes: 1 addition & 1 deletion Samples/iOS-Swift/iOS-SwiftUITests/ProfilingUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class ProfilingUITests: XCTestCase {

XCUIApplication().tabBars["Tab Bar"].buttons["Extra"].tap()
XCUIApplication().tabBars["Tab Bar"].buttons["Transactions"].tap()
app.buttons["Start transaction"].afterWaitingForExistence("Couldn't find button to start transaction").tap()
app.buttons["Start transaction (main thread)"].afterWaitingForExistence("Couldn't find button to start transaction").tap()
XCUIApplication().tabBars["Tab Bar"].buttons["Extra"].tap()
app.buttons["ANR filling run loop"].afterWaitingForExistence("Couldn't find button to ANR").tap()
XCUIApplication().tabBars["Tab Bar"].buttons["Transactions"].tap()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Sentry
import SwiftUI

@available(watchOSApplicationExtension 7.0, *)
struct ContentView: View {

@StateObject var viewModel = ContentViewModel()
Expand Down Expand Up @@ -89,6 +90,7 @@ class ContentViewModel: ObservableObject {
}
}

@available(watchOSApplicationExtension 7.0, *)
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Foundation
import SwiftUI
import WatchKit

@available(watchOSApplicationExtension 7.0, *)
class HostingController: WKHostingController<ContentView> {
override var body: ContentView {
return ContentView()
Expand Down
26 changes: 14 additions & 12 deletions Samples/watchOS-Swift/watchOS-Swift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = 97JCY7859U;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
Expand Down Expand Up @@ -437,6 +438,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 97JCY7859U;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
Expand All @@ -460,9 +462,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"watchOS-Swift WatchKit Extension/Preview Content\"";
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = "watchOS-Swift WatchKit Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -472,6 +472,8 @@
);
PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.watchOS-Swift.watchkitapp.watchkitextension";
PRODUCT_NAME = "${TARGET_NAME}";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=watchos*]" = "match Development io.sentry.*";
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
Expand All @@ -484,9 +486,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"watchOS-Swift WatchKit Extension/Preview Content\"";
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = "watchOS-Swift WatchKit Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -496,6 +496,8 @@
);
PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.watchOS-Swift.watchkitapp.watchkitextension";
PRODUCT_NAME = "${TARGET_NAME}";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=watchos*]" = "match Development io.sentry.*";
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
Expand All @@ -509,12 +511,12 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 97JCY7859U;
IBSC_MODULE = watchOS_Swift_WatchKit_Extension;
INFOPLIST_FILE = "watchOS-Swift WatchKit App/Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.watchOS-Swift.watchkitapp";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=watchos*]" = "match Development io.sentry.*";
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
Expand All @@ -528,12 +530,12 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 97JCY7859U;
IBSC_MODULE = watchOS_Swift_WatchKit_Extension;
INFOPLIST_FILE = "watchOS-Swift WatchKit App/Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.watchOS-Swift.watchkitapp";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=watchos*]" = "match Development io.sentry.*";
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
Expand All @@ -545,25 +547,25 @@
7B82C4B324C98A96002CA6D1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 97JCY7859U;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.watchOS-Swift";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match Development io.sentry.*";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
7B82C4B424C98A96002CA6D1 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 97JCY7859U;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.watchOS-Swift";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match Development io.sentry.*";
SWIFT_VERSION = 5.0;
};
name = Release;
Expand Down
4 changes: 2 additions & 2 deletions Sentry.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Sentry"
s.version = "8.9.4"
s.version = "8.9.6"
s.summary = "Sentry client for cocoa"
s.homepage = "https://github.com/getsentry/sentry-cocoa"
s.license = "mit"
Expand All @@ -27,7 +27,7 @@ Pod::Spec.new do |s|
}

s.default_subspecs = ['Core']
s.dependency "SentryPrivate", "8.9.4"
s.dependency "SentryPrivate", "8.9.6"

s.subspec 'Core' do |sp|
sp.source_files = "Sources/Sentry/**/*.{h,hpp,m,mm,c,cpp}",
Expand Down
2 changes: 1 addition & 1 deletion SentryPrivate.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SentryPrivate"
s.version = "8.9.4"
s.version = "8.9.6"
s.summary = "Sentry Private Library."
s.homepage = "https://github.com/getsentry/sentry-cocoa"
s.license = "mit"
Expand Down
4 changes: 2 additions & 2 deletions SentrySwiftUI.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SentrySwiftUI"
s.version = "8.9.4"
s.version = "8.9.6"
s.summary = "Sentry client for SwiftUI"
s.homepage = "https://github.com/getsentry/sentry-cocoa"
s.license = "mit"
Expand All @@ -19,5 +19,5 @@ Pod::Spec.new do |s|
s.watchos.framework = 'WatchKit'

s.source_files = "Sources/SentrySwiftUI/**/*.{swift,h,m}"
s.dependency 'Sentry', "8.9.4"
s.dependency 'Sentry', "8.9.6"
end
6 changes: 3 additions & 3 deletions SentryTestUtils/TestSentrySystemWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class TestSentrySystemWrapper: SentrySystemWrapper {
public var memoryFootprintBytes: SentryRAMBytes?

public var cpuUsageError: NSError?
public var cpuUsagePerCore: [NSNumber]?
public var cpuUsage: NSNumber?
}

public var overrides = Override()
Expand All @@ -19,10 +19,10 @@ public class TestSentrySystemWrapper: SentrySystemWrapper {
return overrides.memoryFootprintBytes ?? super.memoryFootprintBytes(error)
}

public override func cpuUsagePerCore() throws -> [NSNumber] {
public override func cpuUsage() throws -> NSNumber {
if let errorOverride = overrides.cpuUsageError {
throw errorOverride
}
return try overrides.cpuUsagePerCore ?? super.cpuUsagePerCore()
return try overrides.cpuUsage ?? super.cpuUsage()
}
}
2 changes: 1 addition & 1 deletion Sources/Configuration/Sentry.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ PRODUCT_NAME = Sentry
INFOPLIST_FILE = Sources/Sentry/Info.plist
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.Sentry

CURRENT_PROJECT_VERSION = 8.9.4
CURRENT_PROJECT_VERSION = 8.9.6

MODULEMAP_FILE = $(SRCROOT)/Sources/Sentry/Sentry.modulemap
2 changes: 1 addition & 1 deletion Sources/Configuration/SentryPrivate.xcconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
PRODUCT_NAME = SentryPrivate
MACH_O_TYPE = staticlib
CURRENT_PROJECT_VERSION = 8.9.4
CURRENT_PROJECT_VERSION = 8.9.6
Loading

0 comments on commit e9966d7

Please sign in to comment.