diff --git a/Backtrace.xcodeproj/project.pbxproj b/Backtrace.xcodeproj/project.pbxproj index ecad170c..3a87b3fd 100644 --- a/Backtrace.xcodeproj/project.pbxproj +++ b/Backtrace.xcodeproj/project.pbxproj @@ -411,6 +411,7 @@ 1B23C39D7D0C11ABC494BDF4 /* Pods_Example_macOS_ObjC.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example_macOS_ObjC.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 1F36490C977B28FFED3FA6BB /* Pods-Example-tvOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-tvOS.debug.xcconfig"; path = "Target Support Files/Pods-Example-tvOS/Pods-Example-tvOS.debug.xcconfig"; sourceTree = ""; }; 2046B4552C46F97800A927DB /* BacktraceResources.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BacktraceResources.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; + 2050DB9C2C61A09D00C6CCA9 /* Example-iOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Example-iOS.entitlements"; sourceTree = ""; }; 2062D9C42C457B4500E4CE3C /* Crash+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Crash+CoreDataClass.swift"; sourceTree = ""; }; 2062D9C52C457B4500E4CE3C /* Crash+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Crash+CoreDataProperties.swift"; sourceTree = ""; }; 26A69065BABD7253C1D61320 /* Pods_Backtrace_tvOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Backtrace_tvOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1027,6 +1028,7 @@ F2C2FA4421BBD23B00934744 = { isa = PBXGroup; children = ( + 2050DB9C2C61A09D00C6CCA9 /* Example-iOS.entitlements */, F254690423E6FB750063E4B9 /* Examples */, F266B85321C77D5D00D14417 /* Tests */, F2C2FA8421BBD2AE00934744 /* Sources */, @@ -2495,7 +2497,7 @@ "IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 13.1; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MACOSX_DEPLOYMENT_TARGET = 12.0; - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 2.0.5-alpha1; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -2505,7 +2507,8 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "xrsimulator xros watchsimulator watchos macosx iphonesimulator iphoneos driverkit appletvsimulator appletvos"; - SUPPORTS_MACCATALYST = NO; + SUPPORTS_MACCATALYST = YES; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = bundle; @@ -2582,7 +2585,7 @@ "IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 13.1; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MACOSX_DEPLOYMENT_TARGET = 12.0; - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 2.0.5-alpha1; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = Backtrace.io.BacktraceResources; @@ -2591,7 +2594,8 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "xrsimulator xros watchsimulator watchos macosx iphonesimulator iphoneos driverkit appletvsimulator appletvos"; - SUPPORTS_MACCATALYST = NO; + SUPPORTS_MACCATALYST = YES; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = bundle; @@ -2665,7 +2669,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 2.0.4; + MARKETING_VERSION = 2.0.5-alpha1; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -2745,7 +2749,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 2.0.4; + MARKETING_VERSION = 2.0.5-alpha1; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = Backtrace.io.Backtrace; @@ -2978,7 +2982,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 2.0.4; + MARKETING_VERSION = 2.0.5-alpha1; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -3062,7 +3066,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 2.0.4; + MARKETING_VERSION = 2.0.5-alpha1; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = Backtrace.io.Backtrace; @@ -3292,7 +3296,7 @@ "@executable_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 2.0.4; + MARKETING_VERSION = 2.0.5-alpha1; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -3367,7 +3371,7 @@ "@executable_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 2.0.4; + MARKETING_VERSION = 2.0.5-alpha1; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = apptailors.co.backtrace.swift.tvos.example; @@ -3484,7 +3488,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 2.0.4; + MARKETING_VERSION = 2.0.5-alpha1; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -3493,7 +3497,8 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; STRIP_SWIFT_SYMBOLS = NO; - SUPPORTS_MACCATALYST = NO; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -3571,7 +3576,7 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 2.0.4; + MARKETING_VERSION = 2.0.5-alpha1; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = Backtrace.io.Backtrace; @@ -3579,7 +3584,8 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; STRIP_SWIFT_SYMBOLS = NO; - SUPPORTS_MACCATALYST = NO; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = YES; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_OPTIMIZATION_LEVEL = "-O"; @@ -3784,6 +3790,7 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_ENTITLEMENTS = "Example-iOS.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; @@ -3813,7 +3820,7 @@ "@executable_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 2.0.4; + MARKETING_VERSION = 2.0.5-alpha1; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -3823,6 +3830,8 @@ SDKROOT = iphoneos; STRIP_STYLE = debugging; STRIP_SWIFT_SYMBOLS = NO; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OBJC_BRIDGING_HEADER = "Examples/Common/Examples-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -3866,6 +3875,7 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_ENTITLEMENTS = "Example-iOS.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; @@ -3889,7 +3899,7 @@ "@executable_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 2.0.4; + MARKETING_VERSION = 2.0.5-alpha1; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = apptailors.co.backtrace.swift.ios.example; @@ -3898,6 +3908,8 @@ SDKROOT = iphoneos; STRIP_STYLE = debugging; STRIP_SWIFT_SYMBOLS = NO; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = YES; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OBJC_BRIDGING_HEADER = "Examples/Common/Examples-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-O"; @@ -3972,7 +3984,7 @@ "@executable_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 2.0.4; + MARKETING_VERSION = 2.0.5-alpha1; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -4045,7 +4057,7 @@ "@executable_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 2.0.4; + MARKETING_VERSION = 2.0.5-alpha1; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = apptailors.co.backtrace.objc.ios.examples; @@ -4125,7 +4137,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 2.0.4; + MARKETING_VERSION = 2.0.5-alpha1; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -4197,7 +4209,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; - MARKETING_VERSION = 2.0.4; + MARKETING_VERSION = 2.0.5-alpha1; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = apptailors.co.backtrace.swift.macos.example; diff --git a/Example-iOS.entitlements b/Example-iOS.entitlements new file mode 100644 index 00000000..ee95ab7e --- /dev/null +++ b/Example-iOS.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.network.client + + + diff --git a/Sources/Features/Attributes/DefaultAttributes.swift b/Sources/Features/Attributes/DefaultAttributes.swift index 13de58e8..85c60735 100644 --- a/Sources/Features/Attributes/DefaultAttributes.swift +++ b/Sources/Features/Attributes/DefaultAttributes.swift @@ -83,7 +83,7 @@ struct ProcessorInfo: AttributesSource { struct Device: AttributesSource { var mutable: [String: Any?] { - #if os(iOS) + #if os(iOS) && !targetEnvironment(macCatalyst) let device = UIDevice.current var attributes: [String: Any?] = ["device.orientation": device.orientation.name] if device.isBatteryMonitoringEnabled { @@ -110,11 +110,11 @@ struct Device: AttributesSource { } private func getSysname() -> String { -#if os(iOS) +#if os(iOS) && !targetEnvironment(macCatalyst) return "iOS" #elseif os(tvOS) return "tvOS" -#elseif os(macOS) +#elseif os(macOS) || targetEnvironment(macCatalyst) return "macOS" #else return "Unsupported device" @@ -126,7 +126,7 @@ struct ScreenInfo: AttributesSource { private enum Key: String { case count = "screens.count" - #if os(iOS) || os(tvOS) + #if (os(iOS) || os(tvOS)) && !targetEnvironment(macCatalyst) case scale = "screen.scale" case width = "screen.width" case height = "screen.height" @@ -134,7 +134,7 @@ struct ScreenInfo: AttributesSource { case nativeWidth = "screen.width.native" case nativeHeight = "screen.height.native" case brightness = "screen.brightness" - #elseif os(macOS) + #elseif os(macOS) || targetEnvironment(macCatalyst) case mainScreenWidth = "screen.main.width" case mainScreenHeight = "screen.main.height" case mainScreenScale = "screen.main.scale" @@ -143,7 +143,7 @@ struct ScreenInfo: AttributesSource { var immutable: [String: Any?] { var screenAttributes: Attributes = [:] - #if os(iOS) || os(tvOS) + #if (os(iOS) || os(tvOS)) && !targetEnvironment(macCatalyst) let mainScreen = UIScreen.main screenAttributes[Key.scale.rawValue] = mainScreen.scale screenAttributes[Key.width.rawValue] = mainScreen.bounds.width @@ -152,7 +152,7 @@ struct ScreenInfo: AttributesSource { screenAttributes[Key.nativeWidth.rawValue] = mainScreen.nativeBounds.width screenAttributes[Key.nativeHeight.rawValue] = mainScreen.nativeBounds.height screenAttributes[Key.count.rawValue] = UIScreen.screens.count - #elseif os(macOS) + #elseif os(macOS) || !targetEnvironment(macCatalyst) screenAttributes[Key.count.rawValue] = NSScreen.screens.count if let mainScreen = NSScreen.main { screenAttributes[Key.mainScreenWidth.rawValue] = mainScreen.frame.width @@ -161,7 +161,7 @@ struct ScreenInfo: AttributesSource { } #endif - #if os(iOS) + #if os(iOS) && !targetEnvironment(macCatalyst) screenAttributes[Key.brightness.rawValue] = UIScreen.main.brightness #endif return screenAttributes @@ -252,7 +252,7 @@ struct BreadcrumbsInfo: AttributesSource { // swiftlint:enable type_name -#if os(iOS) +#if os(iOS) && !targetEnvironment(macCatalyst) private extension UIDeviceOrientation { var name: String { @@ -271,7 +271,7 @@ private extension UIDeviceOrientation { } #endif -#if os(iOS) +#if os(iOS) && !targetEnvironment(macCatalyst) private extension UIDevice.BatteryState { var name: String { @@ -287,7 +287,7 @@ private extension UIDevice.BatteryState { } #endif -#if os(iOS) +#if os(iOS) && !targetEnvironment(macCatalyst) private extension UIApplication.State { var name: String { diff --git a/Sources/Features/Attributes/NetworkReachability.swift b/Sources/Features/Attributes/NetworkReachability.swift index 4b6d9eca..7b6a97e1 100644 --- a/Sources/Features/Attributes/NetworkReachability.swift +++ b/Sources/Features/Attributes/NetworkReachability.swift @@ -42,7 +42,7 @@ extension NetworkReachability { guard let flags = flags else { return "unknown" } guard isNetworkReachable(with: flags) else { return "notReachable" } - #if os(iOS) || os(tvOS) + #if (os(iOS) || os(tvOS)) && !targetEnvironment(macCatalyst) if flags.contains(.isWWAN) { return "reachableViaWWAN" } #endif diff --git a/Sources/Features/Breadcrumb/BacktraceNotificationObserver.swift b/Sources/Features/Breadcrumb/BacktraceNotificationObserver.swift index e9c49ebb..c8b09da8 100644 --- a/Sources/Features/Breadcrumb/BacktraceNotificationObserver.swift +++ b/Sources/Features/Breadcrumb/BacktraceNotificationObserver.swift @@ -24,7 +24,7 @@ protocol BacktraceNotificationObserverDelegate: AnyObject { var handlerDelegates: [BacktraceNotificationHandlerDelegate] = [ BacktraceMemoryNotificationObserver(), BacktraceBatteryNotificationObserver()] -#if os(iOS) +#if os(iOS) && !targetEnvironment(macCatalyst) handlerDelegates.append(BacktraceOrientationNotificationObserver()) handlerDelegates.append(BacktraceAppStateNotificationObserver()) handlerDelegates.append(BacktraceCallNotificationObserver()) @@ -343,7 +343,7 @@ class BacktraceBatteryNotificationObserver: NSObject, BacktraceNotificationHandl #endif } -#if os(iOS) +#if os(iOS) && !targetEnvironment(macCatalyst) // MARK: - Application State Observer enum ApplicationState: Int { case willEnterForeground diff --git a/Sources/Features/Client/BacktraceReporter.swift b/Sources/Features/Client/BacktraceReporter.swift index 8c46ed1f..341ea0c7 100644 --- a/Sources/Features/Client/BacktraceReporter.swift +++ b/Sources/Features/Client/BacktraceReporter.swift @@ -2,7 +2,7 @@ import Foundation final class BacktraceReporter { -#if os(macOS) +#if os(macOS) || !targetEnvironment(macCatalyst) lazy var memoryPressureSource: DispatchSourceMemoryPressure = { DispatchSource.makeMemoryPressureSource(eventMask: [.critical, .warning], queue: .global()) }() @@ -126,7 +126,7 @@ extension BacktraceReporter { } } -#if os(iOS) || os(tvOS) +#if (os(iOS) || os(tvOS)) import UIKit typealias Application = UIApplication #elseif os(macOS) @@ -157,7 +157,7 @@ extension BacktraceReporter { name: Application.willResignActiveNotification, object: nil) - #if os(iOS) || os(tvOS) + #if (os(iOS) || os(tvOS)) NotificationCenter.default.addObserver(self, selector: #selector(applicationWillEnterForeground), name: Application.willEnterForegroundNotification, diff --git a/Sources/Features/Repository/Model/Attachment.swift b/Sources/Features/Repository/Model/Attachment.swift index 7a2de8fb..2cd120f2 100644 --- a/Sources/Features/Repository/Model/Attachment.swift +++ b/Sources/Features/Repository/Model/Attachment.swift @@ -1,5 +1,5 @@ import Foundation -#if os(iOS) || os(tvOS) +#if (os(iOS) || os(tvOS)) import MobileCoreServices #elseif os(macOS) import CoreServices diff --git a/Sources/Public/BacktraceClient.swift b/Sources/Public/BacktraceClient.swift index 12b2fcbf..c3adb720 100644 --- a/Sources/Public/BacktraceClient.swift +++ b/Sources/Public/BacktraceClient.swift @@ -12,7 +12,7 @@ import Foundation /// Error-free metrics class instance @objc private let metricsInstance: BacktraceMetrics -#if os(iOS) || os(OSX) +#if os(iOS) || os(OSX) || targetEnvironment(macCatalyst) /// Breadcrumbs class instance @objc private let breadcrumbsInstance: BacktraceBreadcrumbs = BacktraceBreadcrumbs() #endif @@ -220,7 +220,7 @@ extension BacktraceClient: BacktraceMetricsProtocol { } // MARK: - BacktraceBreadcrumbProtocol -#if os(iOS) || os(OSX) +#if os(iOS) || os(OSX) || targetEnvironment(macCatalyst) extension BacktraceClient: BacktraceBreadcrumbProtocol { @objc public var breadcrumbs: BacktraceBreadcrumbs { return self.breadcrumbsInstance diff --git a/Sources/Public/BacktraceClientConfiguration.swift b/Sources/Public/BacktraceClientConfiguration.swift index ab700ee4..9b64b62b 100644 --- a/Sources/Public/BacktraceClientConfiguration.swift +++ b/Sources/Public/BacktraceClientConfiguration.swift @@ -14,7 +14,7 @@ import Foundation /// Error-free metrics settings @objc public var metricsSettings: BacktraceMetricsSettings = BacktraceMetricsSettings() -#if os(iOS) +#if os(iOS) && !targetEnvironment(macCatalyst) /// Breadcrumbs settings. @objc public var breadcrumbSettings: BacktraceBreadcrumbSettings = BacktraceBreadcrumbSettings() #endif diff --git a/Sources/Public/BacktraceClientCustomizing.swift b/Sources/Public/BacktraceClientCustomizing.swift index 4caa68b0..de226c47 100644 --- a/Sources/Public/BacktraceClientCustomizing.swift +++ b/Sources/Public/BacktraceClientCustomizing.swift @@ -1,7 +1,7 @@ import Foundation /// Type-alias of `BacktraceClient` type. Custom Backtrace client have to implement all of these protocols. -#if os(iOS) || os(OSX) +#if os(iOS) || os(OSX) || targetEnvironment(macCatalyst) public typealias BacktraceClientProtocol = BacktraceReporting & BacktraceClientCustomizing & BacktraceLogging & BacktraceMetricsProtocol & BacktraceBreadcrumbProtocol #else @@ -106,7 +106,7 @@ enum BacktraceUrlParsingError: Error { case invalidInput(String) } -#if os(iOS) || os(OSX) +#if os(iOS) || os(OSX) || targetEnvironment(macCatalyst) /// Provides Breadcrumb adding functionality to `BacktraceClient`. @objc public protocol BacktraceBreadcrumbProtocol { @objc var breadcrumbs: BacktraceBreadcrumbs { get } diff --git a/Tests/AttributesTests.swift b/Tests/AttributesTests.swift index c6a529c2..cbc5602a 100644 --- a/Tests/AttributesTests.swift +++ b/Tests/AttributesTests.swift @@ -79,11 +79,11 @@ final class AttributesTests: QuickSpec { fail("could not parse uname.sysname") return } -#if os(iOS) +#if os(iOS) && !targetEnvironment(macCatalyst) expect { sysname }.to(equal("iOS")) #elseif os(tvOS) expect { sysname }.to(equal("tvOS")) -#elseif os(macOS) +#elseif os(macOS) || targetEnvironment(macCatalyst) expect { sysname }.to(equal("macOS")) #else fail("unsupported platform") diff --git a/Tests/BacktraceBreadcrumbTests.swift b/Tests/BacktraceBreadcrumbTests.swift index eb91d5a0..b007550e 100644 --- a/Tests/BacktraceBreadcrumbTests.swift +++ b/Tests/BacktraceBreadcrumbTests.swift @@ -245,7 +245,7 @@ final class BacktraceBreadcrumbTests: QuickSpec { expect { backtraceObserverMock2.startObservingCalled }.to(beTrue()) } } -#if os(iOS) +#if os(iOS) && !targetEnvironment(macCatalyst) describe("when iOS notifications update") { context("for memory warning notification") { it("iOS breadcrumb added") { diff --git a/Tests/BacktraceReporterTests.swift b/Tests/BacktraceReporterTests.swift index 65fe14b3..ce41a63a 100644 --- a/Tests/BacktraceReporterTests.swift +++ b/Tests/BacktraceReporterTests.swift @@ -216,7 +216,7 @@ final class BacktraceReporterTests: QuickSpec { expect { result.report?.attributes["application.session"] }.toNot(beNil()) expect { result.report?.attributes["application.version"] }.toNot(beNil()) } -#if os(iOS) +#if os(iOS) && !targetEnvironment(macCatalyst) it("report should have breadcrumbs attributes if breadcrumbs is enabled") { let breadcrumbs = BacktraceBreadcrumbs() breadcrumbs.enableBreadcrumbs() diff --git a/Tests/Mocks/BacktraceNotificationObserverMock.swift b/Tests/Mocks/BacktraceNotificationObserverMock.swift index d1a3a41e..3f17bea6 100644 --- a/Tests/Mocks/BacktraceNotificationObserverMock.swift +++ b/Tests/Mocks/BacktraceNotificationObserverMock.swift @@ -2,7 +2,7 @@ import Foundation import XCTest @testable import Backtrace -#if os(iOS) || os(OSX) +#if os(iOS) || os(OSX) || targetEnvironment(macCatalyst) class BacktraceObserverMock: BacktraceNotificationHandlerDelegate { var delegate: BacktraceNotificationObserverDelegate? diff --git a/fastlane/Fastfile b/fastlane/Fastfile index f872a8b8..a7fd1978 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -20,7 +20,12 @@ platform :ios do lane :tests do sync_podspec_version_to_xcode() common_tests(scheme: "Backtrace-iOS-lib", disable_slide_to_type: true) - ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"] = "120" + end + + desc "Run Mac Catalyst tests" + lane :catalyst_tests do + sync_podspec_version_to_xcode() + common_tests(scheme: "Backtrace-macOS-lib", disable_slide_to_type: true) end end diff --git a/fastlane/README.md b/fastlane/README.md index c6239aaf..4accd8df 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -42,6 +42,14 @@ Sync Podspec version to Xcode MARKETING_VERSION Run iOS tests +### ios catalyst_tests + +```sh +[bundle exec] fastlane ios catalyst_tests +``` + +Run Mac Catalyst tests + ---- diff --git a/scripts/test.sh b/scripts/test.sh index 7cce5e70..d7271df4 100644 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -5,6 +5,7 @@ set -o nounset # to exit when your script tries to use undeclared variables set -o xtrace # to trace what gets executed. Useful for debugging fastlane ios tests +fastlane ios catalyst_tests fastlane mac tests fastlane tvos tests pod lib lint --verbose --allow-warnings --sources='https://cdn.cocoapods.org/' \ No newline at end of file diff --git a/scripts/xcframeworkgen.sh b/scripts/xcframeworkgen.sh index 28942c76..ffc7476f 100644 --- a/scripts/xcframeworkgen.sh +++ b/scripts/xcframeworkgen.sh @@ -33,6 +33,16 @@ xcodebuild archive \ DEBUG_INFORMATION_FORMAT="dwarf-with-dsym" GCC_GENERATE_DEBUGGING_SYMBOLS=YES \ BUILD_LIBRARY_FOR_DISTRIBUTION=YES SKIP_INSTALL=NO +xcodebuild archive \ + -workspace Backtrace.xcworkspace \ + -scheme "Backtrace-iOS-lib" \ + -destination "platform=macOS,variant=Mac Catalyst" \ + -archivePath ${BUILD_PATH}/Backtrace-iOS-MacCatalyst-lib.xcarchive \ + -derivedDataPath ${DERIVED_DATA_PATH} \ + -configuration Release \ + DEBUG_INFORMATION_FORMAT="dwarf-with-dsym" GCC_GENERATE_DEBUGGING_SYMBOLS=YES \ + SUPPORTS_MACCATALYST=YES BUILD_LIBRARY_FOR_DISTRIBUTION=YES SKIP_INSTALL=NO + xcodebuild archive \ -workspace Backtrace.xcworkspace \ -scheme "Backtrace-macOS-lib" \ @@ -66,6 +76,7 @@ xcodebuild archive \ xcodebuild -create-xcframework \ -archive ${BUILD_PATH}/Backtrace-iOS-lib.xcarchive -framework Backtrace.framework \ -archive ${BUILD_PATH}/Backtrace-iOS-Simulator-lib.xcarchive -framework Backtrace.framework \ + -archive ${BUILD_PATH}/Backtrace-iOS-MacCatalyst-lib.xcarchive -framework Backtrace.framework \ -archive ${BUILD_PATH}/Backtrace-macOS-lib.xcarchive -framework Backtrace.framework \ -archive ${BUILD_PATH}/Backtrace-tvOS-lib.xcarchive -framework Backtrace.framework \ -archive ${BUILD_PATH}/Backtrace-tvOS-Simulator-lib.xcarchive -framework Backtrace.framework \