diff --git a/SentryTestUtils/ClearTestState.swift b/SentryTestUtils/ClearTestState.swift index 9294fd41c25..db673e717a6 100644 --- a/SentryTestUtils/ClearTestState.swift +++ b/SentryTestUtils/ClearTestState.swift @@ -1,5 +1,5 @@ import Foundation -@testable import Sentry +@_spi(Private) @testable import Sentry public func clearTestState() { TestCleanup.clearTestState() diff --git a/SentryTestUtils/SentryLogExtensions.swift b/SentryTestUtils/SentryLogExtensions.swift index 0ccc580d05e..826bdc23099 100644 --- a/SentryTestUtils/SentryLogExtensions.swift +++ b/SentryTestUtils/SentryLogExtensions.swift @@ -1,5 +1,5 @@ import Foundation -@testable import Sentry +@_spi(Private) @testable import Sentry extension SentryLog { public static func setTestDefaultLogLevel() { diff --git a/SentryTestUtils/TestHub.swift b/SentryTestUtils/TestHub.swift index 9b6a0988aa7..fd6b53c5c97 100644 --- a/SentryTestUtils/TestHub.swift +++ b/SentryTestUtils/TestHub.swift @@ -1,6 +1,6 @@ import _SentryPrivate import Foundation -@testable import Sentry +@_spi(Private) @testable import Sentry public class TestHub: SentryHub { @@ -51,8 +51,8 @@ public class TestHub: SentryHub { } public var onReplayCapture: (() -> Void)? - public var capturedReplayRecordingVideo = Invocations<(replay: SentryReplayEvent, recording: SentryReplayRecording, video: URL)>() - public override func capture(_ replayEvent: SentryReplayEvent, replayRecording: SentryReplayRecording, video videoURL: URL) { + @_spi(Private) public var capturedReplayRecordingVideo = Invocations<(replay: SentryReplayEvent, recording: SentryReplayRecording, video: URL)>() + @_spi(Private) public override func capture(_ replayEvent: SentryReplayEvent, replayRecording: SentryReplayRecording, video videoURL: URL) { capturedReplayRecordingVideo.record((replayEvent, replayRecording, videoURL)) onReplayCapture?() } diff --git a/Sources/Swift/Core/Helper/Log/SentryLevel.swift b/Sources/Swift/Core/Helper/Log/SentryLevel.swift index 50f512b9f26..2a0f3fe01c4 100644 --- a/Sources/Swift/Core/Helper/Log/SentryLevel.swift +++ b/Sources/Swift/Core/Helper/Log/SentryLevel.swift @@ -36,12 +36,12 @@ extension SentryLevel: CustomStringConvertible { } @objcMembers -class SentryLevelHelper: NSObject { - static func nameForLevel(_ level: SentryLevel) -> String { +@_spi(Private) public class SentryLevelHelper: NSObject { + public static func nameForLevel(_ level: SentryLevel) -> String { return level.description } - static func levelForName(_ name: String) -> SentryLevel { + public static func levelForName(_ name: String) -> SentryLevel { .fromName(name) } } diff --git a/Sources/Swift/Core/Helper/SentryCurrentDateProvider.swift b/Sources/Swift/Core/Helper/SentryCurrentDateProvider.swift index a25e9043e2c..851df07fe9e 100644 --- a/Sources/Swift/Core/Helper/SentryCurrentDateProvider.swift +++ b/Sources/Swift/Core/Helper/SentryCurrentDateProvider.swift @@ -13,12 +13,12 @@ protocol SentryCurrentDateProvider { } @objcMembers -class SentryDefaultCurrentDateProvider: NSObject, SentryCurrentDateProvider { - func date() -> Date { +@_spi(Private) public class SentryDefaultCurrentDateProvider: NSObject, SentryCurrentDateProvider { + public func date() -> Date { return Date() } - func timezoneOffset() -> Int { + public func timezoneOffset() -> Int { return TimeZone.current.secondsFromGMT() } @@ -26,7 +26,7 @@ class SentryDefaultCurrentDateProvider: NSObject, SentryCurrentDateProvider { * Returns the absolute timestamp, which has no defined reference point or unit * as it is platform dependent. */ - func systemTime() -> UInt64 { + public func systemTime() -> UInt64 { Self.getAbsoluteTime() } @@ -34,7 +34,7 @@ class SentryDefaultCurrentDateProvider: NSObject, SentryCurrentDateProvider { ProcessInfo.processInfo.systemUptime } - static func getAbsoluteTime() -> UInt64 { + public static func getAbsoluteTime() -> UInt64 { clock_gettime_nsec_np(CLOCK_UPTIME_RAW) } } diff --git a/Sources/Swift/Core/Helper/SentryFileContents.swift b/Sources/Swift/Core/Helper/SentryFileContents.swift index 9778b4f5d1d..e367ca5ebdc 100644 --- a/Sources/Swift/Core/Helper/SentryFileContents.swift +++ b/Sources/Swift/Core/Helper/SentryFileContents.swift @@ -1,12 +1,12 @@ import Foundation @objcMembers -class SentryFileContents: NSObject { +@_spi(Private) public class SentryFileContents: NSObject { - let path: String - let contents: Data + public let path: String + public let contents: Data - init(path: String, contents: Data) { + public init(path: String, contents: Data) { self.path = path self.contents = contents } diff --git a/Sources/Swift/Core/MetricKit/SentryMXCallStackTree.swift b/Sources/Swift/Core/MetricKit/SentryMXCallStackTree.swift index 850d4f718fb..df1d8ed50c4 100644 --- a/Sources/Swift/Core/MetricKit/SentryMXCallStackTree.swift +++ b/Sources/Swift/Core/MetricKit/SentryMXCallStackTree.swift @@ -5,10 +5,10 @@ import Foundation * JSON specification of MXCallStackTree can be found here https://developer.apple.com/documentation/metrickit/mxcallstacktree/3552293-jsonrepresentation */ @objcMembers -class SentryMXCallStackTree: NSObject, Codable { +@_spi(Private) public class SentryMXCallStackTree: NSObject, Codable { - let callStacks: [SentryMXCallStack] - let callStackPerThread: Bool + public let callStacks: [SentryMXCallStack] + public let callStackPerThread: Bool init(callStacks: [SentryMXCallStack], callStackPerThread: Bool) { self.callStacks = callStacks @@ -21,11 +21,11 @@ class SentryMXCallStackTree: NSObject, Codable { } @objcMembers -class SentryMXCallStack: NSObject, Codable { - var threadAttributed: Bool? - var callStackRootFrames: [SentryMXFrame] +@_spi(Private) public class SentryMXCallStack: NSObject, Codable { + public var threadAttributed: Bool? + public var callStackRootFrames: [SentryMXFrame] - var flattenedRootFrames: [SentryMXFrame] { + public var flattenedRootFrames: [SentryMXFrame] { return callStackRootFrames.flatMap { [$0] + $0.frames } } @@ -36,14 +36,14 @@ class SentryMXCallStack: NSObject, Codable { } @objcMembers -class SentryMXFrame: NSObject, Codable { - var binaryUUID: UUID - var offsetIntoBinaryTextSegment: Int - var binaryName: String? - var address: UInt64 - var subFrames: [SentryMXFrame]? +@_spi(Private) public class SentryMXFrame: NSObject, Codable { + public var binaryUUID: UUID + public var offsetIntoBinaryTextSegment: Int + public var binaryName: String? + public var address: UInt64 + public var subFrames: [SentryMXFrame]? - var sampleCount: Int? + public var sampleCount: Int? init(binaryUUID: UUID, offsetIntoBinaryTextSegment: Int, sampleCount: Int? = nil, binaryName: String? = nil, address: UInt64, subFrames: [SentryMXFrame]?) { self.binaryUUID = binaryUUID diff --git a/Sources/Swift/Core/MetricKit/SentryMXManager.swift b/Sources/Swift/Core/MetricKit/SentryMXManager.swift index 9bf449f0473..58cbb915d44 100644 --- a/Sources/Swift/Core/MetricKit/SentryMXManager.swift +++ b/Sources/Swift/Core/MetricKit/SentryMXManager.swift @@ -12,7 +12,7 @@ import MetricKit @available(iOS 15.0, macOS 12.0, macCatalyst 15.0, *) @available(tvOS, unavailable) @available(watchOS, unavailable) -@objc protocol SentryMXManagerDelegate { +@objc @_spi(Private) public protocol SentryMXManagerDelegate { func didReceiveCrashDiagnostic(_ diagnostic: MXCrashDiagnostic, callStackTree: SentryMXCallStackTree, timeStampBegin: Date, timeStampEnd: Date) @@ -26,7 +26,7 @@ import MetricKit @available(iOS 15.0, macOS 12.0, macCatalyst 15.0, *) @available(tvOS, unavailable) @available(watchOS, unavailable) -@objcMembers class SentryMXManager: NSObject, MXMetricManagerSubscriber { +@objcMembers @_spi(Private) public class SentryMXManager: NSObject, MXMetricManagerSubscriber { let disableCrashDiagnostics: Bool @@ -36,17 +36,17 @@ import MetricKit weak var delegate: SentryMXManagerDelegate? - func receiveReports() { + public func receiveReports() { let shared = MXMetricManager.shared shared.add(self) } - func pauseReports() { + public func pauseReports() { let shared = MXMetricManager.shared shared.remove(self) } - func didReceive(_ payloads: [MXDiagnosticPayload]) { + public func didReceive(_ payloads: [MXDiagnosticPayload]) { func actOn(callStackTree: MXCallStackTree, action: (SentryMXCallStackTree) -> Void) { guard let callStackTree = try? SentryMXCallStackTree.from(data: callStackTree.jsonRepresentation()) else { return diff --git a/Sources/Swift/Core/SwiftDescriptor.swift b/Sources/Swift/Core/SwiftDescriptor.swift index 6d6e996857b..17f8af83399 100644 --- a/Sources/Swift/Core/SwiftDescriptor.swift +++ b/Sources/Swift/Core/SwiftDescriptor.swift @@ -5,17 +5,17 @@ import UIKit #endif @objc -class SwiftDescriptor: NSObject { +@_spi(Private) public class SwiftDescriptor: NSObject { @objc - static func getObjectClassName(_ object: AnyObject) -> String { + public static func getObjectClassName(_ object: AnyObject) -> String { return String(describing: type(of: object)) } /// UIViewControllers aren't available on watchOS #if canImport(UIKit) && !os(watchOS) && !SENTRY_NO_UIKIT @objc - static func getViewControllerClassName(_ object: UIViewController) -> String { + public static func getViewControllerClassName(_ object: UIViewController) -> String { if let object = object as? SentryUIViewControllerDescriptor { return object.sentryName } @@ -24,7 +24,7 @@ class SwiftDescriptor: NSObject { #endif @objc - static func getSwiftErrorDescription(_ error: Error) -> String? { + public static func getSwiftErrorDescription(_ error: Error) -> String? { return String(describing: error) } } diff --git a/Sources/Swift/Core/Tools/HTTPHeaderSanitizer.swift b/Sources/Swift/Core/Tools/HTTPHeaderSanitizer.swift index b78a96b0dd3..5d9b99d959a 100644 --- a/Sources/Swift/Core/Tools/HTTPHeaderSanitizer.swift +++ b/Sources/Swift/Core/Tools/HTTPHeaderSanitizer.swift @@ -1,8 +1,8 @@ import Foundation @objcMembers -class HTTPHeaderSanitizer: NSObject { - static func sanitizeHeaders(_ headers: [String: String]) -> [String: String] { +@_spi(Private) public class HTTPHeaderSanitizer: NSObject { + public static func sanitizeHeaders(_ headers: [String: String]) -> [String: String] { let _securityHeaders = Set([ "X-FORWARDED-FOR", "AUTHORIZATION", "COOKIE", "SET-COOKIE", "X-API-KEY", "X-REAL-IP", "REMOTE-ADDR", "FORWARDED", "PROXY-AUTHORIZATION", "X-CSRF-TOKEN", "X-CSRFTOKEN", diff --git a/Sources/Swift/Core/Tools/SentryLog.swift b/Sources/Swift/Core/Tools/SentryLog.swift index b8833356b46..a251536e464 100644 --- a/Sources/Swift/Core/Tools/SentryLog.swift +++ b/Sources/Swift/Core/Tools/SentryLog.swift @@ -11,7 +11,7 @@ import Foundation /// and the thread sanitizer would surface these race conditions. We accept these race conditions for /// the log messages in the tests over adding locking for all log messages. @objc -class SentryLog: NSObject { +@_spi(Private) public class SentryLog: NSObject { static private(set) var isDebug = true static private(set) var diagnosticLevel = SentryLevel.error @@ -29,7 +29,7 @@ class SentryLog: NSObject { } @objc - static func log(message: String, andLevel level: SentryLevel) { + public static func log(message: String, andLevel level: SentryLevel) { guard willLog(atLevel: level) else { return } // We use the timeIntervalSinceReferenceDate because date format is @@ -45,7 +45,7 @@ class SentryLog: NSObject { * @c NO if not. */ @objc - static func willLog(atLevel level: SentryLevel) -> Bool { + public static func willLog(atLevel level: SentryLevel) -> Bool { if level == .none { return false } diff --git a/Sources/Swift/Core/Tools/URLSessionTaskHelper.swift b/Sources/Swift/Core/Tools/URLSessionTaskHelper.swift index 6018e1df7b2..9217dae65e4 100644 --- a/Sources/Swift/Core/Tools/URLSessionTaskHelper.swift +++ b/Sources/Swift/Core/Tools/URLSessionTaskHelper.swift @@ -1,9 +1,9 @@ import Foundation @objcMembers -class URLSessionTaskHelper: NSObject { +@_spi(Private) public class URLSessionTaskHelper: NSObject { - static func getGraphQLOperationName(from task: URLSessionTask?) -> String? { + public static func getGraphQLOperationName(from task: URLSessionTask?) -> String? { guard let task = task else { return nil } guard task.originalRequest?.value(forHTTPHeaderField: "Content-Type") == "application/json" else { return nil } guard let requestBody = task.originalRequest?.httpBody else { return nil } diff --git a/Sources/Swift/Core/Tools/UrlSanitized.swift b/Sources/Swift/Core/Tools/UrlSanitized.swift index 705ebe68b73..f821cbe91fa 100644 --- a/Sources/Swift/Core/Tools/UrlSanitized.swift +++ b/Sources/Swift/Core/Tools/UrlSanitized.swift @@ -1,15 +1,15 @@ import Foundation @objcMembers -class UrlSanitized: NSObject { +@_spi(Private) public class UrlSanitized: NSObject { static let SENSITIVE_DATA_SUBSTITUTE = "[Filtered]" private var components: URLComponents? - var query: String? { components?.query } - var queryItems: [URLQueryItem]? { components?.queryItems } - var fragment: String? { components?.fragment } + public var query: String? { components?.query } + public var queryItems: [URLQueryItem]? { components?.queryItems } + public var fragment: String? { components?.fragment } - init(URL url: URL) { + public init(URL url: URL) { components = URLComponents(url: url, resolvingAgainstBaseURL: false) if components?.user != nil { @@ -21,7 +21,7 @@ class UrlSanitized: NSObject { } } - var sanitizedUrl: String? { + public var sanitizedUrl: String? { guard var result = self.components?.string else { return nil } if let end = result.firstIndex(of: "?") ?? result.firstIndex(of: "#") { result = String(result[result.startIndex.. [String] { + public static func getEnabledFeatures(options: Options?) -> [String] { guard let options = options else { return [] } diff --git a/Sources/Swift/Integrations/SessionReplay/SentryReplayEvent.swift b/Sources/Swift/Integrations/SessionReplay/SentryReplayEvent.swift index 90b611078a5..61f2c99bdd3 100644 --- a/Sources/Swift/Integrations/SessionReplay/SentryReplayEvent.swift +++ b/Sources/Swift/Integrations/SessionReplay/SentryReplayEvent.swift @@ -2,27 +2,27 @@ import Foundation @objcMembers -class SentryReplayEvent: Event { +@_spi(Private) public class SentryReplayEvent: Event { // Start time of the replay segment - let replayStartTimestamp: Date + public let replayStartTimestamp: Date // The Type of the replay - let replayType: SentryReplayType + public let replayType: SentryReplayType /** * Number of the segment in the replay. * This is an incremental number */ - let segmentId: Int + public let segmentId: Int /** * This will be used to store the name of the screens * that appear during the duration of the replay segment. */ - var urls: [String]? - - init(eventId: SentryId, replayStartTimestamp: Date, replayType: SentryReplayType, segmentId: Int) { + public var urls: [String]? + + public init(eventId: SentryId, replayStartTimestamp: Date, replayType: SentryReplayType, segmentId: Int) { self.replayStartTimestamp = replayStartTimestamp self.replayType = replayType self.segmentId = segmentId @@ -36,7 +36,7 @@ class SentryReplayEvent: Event { fatalError("init() has not been implemented") } - override func serialize() -> [String: Any] { + public override func serialize() -> [String: Any] { var result = super.serialize() result["urls"] = urls result["replay_start_timestamp"] = replayStartTimestamp.timeIntervalSince1970 diff --git a/Sources/Swift/Integrations/SessionReplay/SentryReplayRecording.swift b/Sources/Swift/Integrations/SessionReplay/SentryReplayRecording.swift index 4ace4cb51c3..568e6a64b5f 100644 --- a/Sources/Swift/Integrations/SessionReplay/SentryReplayRecording.swift +++ b/Sources/Swift/Integrations/SessionReplay/SentryReplayRecording.swift @@ -1,7 +1,7 @@ import Foundation @objcMembers -class SentryReplayRecording: NSObject { +@_spi(Private) public class SentryReplayRecording: NSObject { static let SentryReplayEncoding = "h264" static let SentryReplayContainer = "mp4" diff --git a/Sources/Swift/Integrations/SessionReplay/SentryReplayType.swift b/Sources/Swift/Integrations/SessionReplay/SentryReplayType.swift index a933d8220c7..ed20ec9a6de 100644 --- a/Sources/Swift/Integrations/SessionReplay/SentryReplayType.swift +++ b/Sources/Swift/Integrations/SessionReplay/SentryReplayType.swift @@ -1,7 +1,7 @@ import Foundation @objc -enum SentryReplayType: Int { +@_spi(Private) public enum SentryReplayType: Int { case session case buffer } @@ -18,7 +18,7 @@ extension SentryReplayType { // Implementing the CustomStringConvertible protocol to provide a string representation of the enum values. // This method will be called by the Swift runtime when converting the enum to a string, i.e. in String interpolations. extension SentryReplayType: CustomStringConvertible { - var description: String { + public var description: String { return toString() } } diff --git a/Sources/Swift/Protocol/Codable/SentryEventDecoder.swift b/Sources/Swift/Protocol/Codable/SentryEventDecoder.swift index 8797fc29993..231c9b962f0 100644 --- a/Sources/Swift/Protocol/Codable/SentryEventDecoder.swift +++ b/Sources/Swift/Protocol/Codable/SentryEventDecoder.swift @@ -2,7 +2,7 @@ import Foundation @objcMembers public class SentryEventDecoder: NSObject { - static func decodeEvent(jsonData: Data) -> Event? { + @_spi(Private) public static func decodeEvent(jsonData: Data) -> Event? { return decodeFromJSONData(jsonData: jsonData) as SentryEventDecodable? } } diff --git a/Sources/Swift/Tools/SentryLog+Configure.swift b/Sources/Swift/Tools/SentryLog+Configure.swift index 2b534eb8b6f..6289f6a14d5 100644 --- a/Sources/Swift/Tools/SentryLog+Configure.swift +++ b/Sources/Swift/Tools/SentryLog+Configure.swift @@ -5,7 +5,7 @@ import Foundation // The result would be the selector would be missing at runtime and objc code that calls the method would crash. // More details here: https://github.com/swiftlang/swift/issues/48561 @objc -class SentryLogSwiftSupport: NSObject { +@_spi(Private) public class SentryLogSwiftSupport: NSObject { @objc public static func configure(_ isDebug: Bool, diagnosticLevel: SentryLevel) { diff --git a/Tests/SentryProfilerTests/SentryContinuousProfilerTests.swift b/Tests/SentryProfilerTests/SentryContinuousProfilerTests.swift index b58ce1cd2ff..e93a55dcf2d 100644 --- a/Tests/SentryProfilerTests/SentryContinuousProfilerTests.swift +++ b/Tests/SentryProfilerTests/SentryContinuousProfilerTests.swift @@ -1,5 +1,5 @@ import _SentryPrivate -@testable import Sentry +@_spi(Private) @testable import Sentry import SentryTestUtils import XCTest diff --git a/Tests/SentryProfilerTests/SentryTraceProfilerTests.swift b/Tests/SentryProfilerTests/SentryTraceProfilerTests.swift index 94208169104..c6858680011 100644 --- a/Tests/SentryProfilerTests/SentryTraceProfilerTests.swift +++ b/Tests/SentryProfilerTests/SentryTraceProfilerTests.swift @@ -1,5 +1,5 @@ import _SentryPrivate -@testable import Sentry +@_spi(Private) @testable import Sentry import SentryTestUtils import XCTest diff --git a/Tests/SentryTests/Helper/SentryEnabledFeaturesBuilderTests.swift b/Tests/SentryTests/Helper/SentryEnabledFeaturesBuilderTests.swift index fa8f354600f..c3d3d537dc8 100644 --- a/Tests/SentryTests/Helper/SentryEnabledFeaturesBuilderTests.swift +++ b/Tests/SentryTests/Helper/SentryEnabledFeaturesBuilderTests.swift @@ -1,4 +1,4 @@ -@testable import Sentry +@_spi(Private) @testable import Sentry import XCTest final class SentryEnabledFeaturesBuilderTests: XCTestCase { diff --git a/Tests/SentryTests/Helper/SentryFileManagerTests.swift b/Tests/SentryTests/Helper/SentryFileManagerTests.swift index 80b8f25959c..c3eb07c7768 100644 --- a/Tests/SentryTests/Helper/SentryFileManagerTests.swift +++ b/Tests/SentryTests/Helper/SentryFileManagerTests.swift @@ -1,6 +1,6 @@ // swiftlint:disable file_length -@testable import Sentry +@_spi(Private) @testable import Sentry import SentryTestUtils import XCTest diff --git a/Tests/SentryTests/Helper/SentryLog.swift b/Tests/SentryTests/Helper/SentryLog.swift index 6b49aa9ca06..1c05376a5a4 100644 --- a/Tests/SentryTests/Helper/SentryLog.swift +++ b/Tests/SentryTests/Helper/SentryLog.swift @@ -1,6 +1,4 @@ -@testable import Sentry - -typealias SentryLog = Sentry.SentryLog +@_spi(Private) @testable import Sentry //Exposing internal/test functions from SentryLog extension Sentry.SentryLog { diff --git a/Tests/SentryTests/Helper/SentryLogTests.swift b/Tests/SentryTests/Helper/SentryLogTests.swift index 36ccc1af5ba..f9d2745c80c 100644 --- a/Tests/SentryTests/Helper/SentryLogTests.swift +++ b/Tests/SentryTests/Helper/SentryLogTests.swift @@ -1,4 +1,4 @@ -@testable import Sentry +@_spi(Private) @testable import Sentry import SentryTestUtils import XCTest diff --git a/Tests/SentryTests/Helper/SentrySerializationTests.swift b/Tests/SentryTests/Helper/SentrySerializationTests.swift index 6b15c3c496d..8edd32874f3 100644 --- a/Tests/SentryTests/Helper/SentrySerializationTests.swift +++ b/Tests/SentryTests/Helper/SentrySerializationTests.swift @@ -1,4 +1,4 @@ -@testable import Sentry +@_spi(Private) @testable import Sentry import SentryTestUtils import XCTest diff --git a/Tests/SentryTests/Integrations/ANR/SentryANRTrackerV1Tests.swift b/Tests/SentryTests/Integrations/ANR/SentryANRTrackerV1Tests.swift index 765ffbe2c53..d27335dddc6 100644 --- a/Tests/SentryTests/Integrations/ANR/SentryANRTrackerV1Tests.swift +++ b/Tests/SentryTests/Integrations/ANR/SentryANRTrackerV1Tests.swift @@ -1,5 +1,5 @@ -@testable import Sentry -import SentryTestUtils +@_spi(Private) @testable import Sentry +@_spi(Private) import SentryTestUtils import XCTest #if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst) diff --git a/Tests/SentryTests/Integrations/ANR/SentryANRTrackerV2Tests.swift b/Tests/SentryTests/Integrations/ANR/SentryANRTrackerV2Tests.swift index e67c9f954e3..fba77149f07 100644 --- a/Tests/SentryTests/Integrations/ANR/SentryANRTrackerV2Tests.swift +++ b/Tests/SentryTests/Integrations/ANR/SentryANRTrackerV2Tests.swift @@ -1,5 +1,5 @@ -@testable import Sentry -import SentryTestUtils +@_spi(Private) @testable import Sentry +@_spi(Private) import SentryTestUtils import XCTest #if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst) diff --git a/Tests/SentryTests/Integrations/Feedback/SentryFeedbackTests.swift b/Tests/SentryTests/Integrations/Feedback/SentryFeedbackTests.swift index 35b232f3012..0bb3db2ede7 100644 --- a/Tests/SentryTests/Integrations/Feedback/SentryFeedbackTests.swift +++ b/Tests/SentryTests/Integrations/Feedback/SentryFeedbackTests.swift @@ -1,6 +1,7 @@ import Foundation #if os(iOS) && !SENTRY_NO_UIKIT -@testable import Sentry +@_spi(Private) @testable import Sentry +@_spi(Private) import SentryTestUtils import XCTest class SentryFeedbackTests: XCTestCase { diff --git a/Tests/SentryTests/Integrations/MetricKit/SentryMXCallStackTreeTests.swift b/Tests/SentryTests/Integrations/MetricKit/SentryMXCallStackTreeTests.swift index a1a457aa801..3783e55b71d 100644 --- a/Tests/SentryTests/Integrations/MetricKit/SentryMXCallStackTreeTests.swift +++ b/Tests/SentryTests/Integrations/MetricKit/SentryMXCallStackTreeTests.swift @@ -1,5 +1,5 @@ #if os(iOS) || os(macOS) -@testable import Sentry +@_spi(Private) @testable import Sentry import XCTest /** diff --git a/Tests/SentryTests/Integrations/MetricKit/SentryMXManagerTests.swift b/Tests/SentryTests/Integrations/MetricKit/SentryMXManagerTests.swift index d8cf62aa52a..d5503572f60 100644 --- a/Tests/SentryTests/Integrations/MetricKit/SentryMXManagerTests.swift +++ b/Tests/SentryTests/Integrations/MetricKit/SentryMXManagerTests.swift @@ -1,5 +1,5 @@ import MetricKit -@testable import Sentry +@_spi(Private) @testable import Sentry import SentryTestUtils import XCTest diff --git a/Tests/SentryTests/Integrations/MetricKit/SentryMetricKitIntegrationTests.swift b/Tests/SentryTests/Integrations/MetricKit/SentryMetricKitIntegrationTests.swift index 2b452dcca84..7e654524ad4 100644 --- a/Tests/SentryTests/Integrations/MetricKit/SentryMetricKitIntegrationTests.swift +++ b/Tests/SentryTests/Integrations/MetricKit/SentryMetricKitIntegrationTests.swift @@ -1,4 +1,4 @@ -@testable import Sentry +@_spi(Private) @testable import Sentry import SentryTestUtils import XCTest diff --git a/Tests/SentryTests/Integrations/Performance/AppStartTracking/SentryAppStartTrackingIntegrationTests.swift b/Tests/SentryTests/Integrations/Performance/AppStartTracking/SentryAppStartTrackingIntegrationTests.swift index 64ee2b63ab0..808cc8c583a 100644 --- a/Tests/SentryTests/Integrations/Performance/AppStartTracking/SentryAppStartTrackingIntegrationTests.swift +++ b/Tests/SentryTests/Integrations/Performance/AppStartTracking/SentryAppStartTrackingIntegrationTests.swift @@ -1,5 +1,6 @@ import _SentryPrivate -import SentryTestUtils +@_spi(Private) import Sentry +@_spi(Private) import SentryTestUtils import XCTest #if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst) diff --git a/Tests/SentryTests/Integrations/Performance/SentryPerformanceTrackerTests.swift b/Tests/SentryTests/Integrations/Performance/SentryPerformanceTrackerTests.swift index b1853bac97c..201ac57539d 100644 --- a/Tests/SentryTests/Integrations/Performance/SentryPerformanceTrackerTests.swift +++ b/Tests/SentryTests/Integrations/Performance/SentryPerformanceTrackerTests.swift @@ -1,4 +1,5 @@ -import SentryTestUtils +@_spi(Private) import Sentry +@_spi(Private) import SentryTestUtils import XCTest class SentryPerformanceTrackerTests: XCTestCase { diff --git a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerPerformanceTrackerTests.swift b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerPerformanceTrackerTests.swift index 45ab3b44eba..31b24f9b9e3 100644 --- a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerPerformanceTrackerTests.swift +++ b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerPerformanceTrackerTests.swift @@ -1,7 +1,7 @@ #if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst) import ObjectiveC -@testable import Sentry +@_spi(Private) @testable import Sentry import SentryTestUtils import XCTest diff --git a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift index 71c0fbc38c6..22509bc2ab7 100644 --- a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift +++ b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift @@ -1,6 +1,6 @@ #if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst) -@testable import Sentry +@_spi(Private) @testable import Sentry import SentryTestUtils import SentryTestUtilsDynamic import XCTest diff --git a/Tests/SentryTests/Integrations/SentryBaseIntegrationTests.swift b/Tests/SentryTests/Integrations/SentryBaseIntegrationTests.swift index 5ae51c7b07f..181ce0e14c4 100644 --- a/Tests/SentryTests/Integrations/SentryBaseIntegrationTests.swift +++ b/Tests/SentryTests/Integrations/SentryBaseIntegrationTests.swift @@ -1,4 +1,4 @@ -@testable import Sentry +@_spi(Private) @testable import Sentry import XCTest class MyTestIntegration: SentryBaseIntegration { diff --git a/Tests/SentryTests/Integrations/SentryCrash/SentryCrashIntegrationTests.swift b/Tests/SentryTests/Integrations/SentryCrash/SentryCrashIntegrationTests.swift index b65357b2c1c..0a7db72e80c 100644 --- a/Tests/SentryTests/Integrations/SentryCrash/SentryCrashIntegrationTests.swift +++ b/Tests/SentryTests/Integrations/SentryCrash/SentryCrashIntegrationTests.swift @@ -1,4 +1,4 @@ -@testable import Sentry +@_spi(Private) @testable import Sentry import SentryTestUtils import XCTest diff --git a/Tests/SentryTests/Integrations/SessionReplay/SentryReplayEventTests.swift b/Tests/SentryTests/Integrations/SessionReplay/SentryReplayEventTests.swift index 81a9edccfff..1fb718ba852 100644 --- a/Tests/SentryTests/Integrations/SessionReplay/SentryReplayEventTests.swift +++ b/Tests/SentryTests/Integrations/SessionReplay/SentryReplayEventTests.swift @@ -1,5 +1,5 @@ import Foundation -@testable import Sentry +@_spi(Private) @testable import Sentry import XCTest class SentryReplayEventTests: XCTestCase { diff --git a/Tests/SentryTests/Integrations/SessionReplay/SentryReplayRecordingTests.swift b/Tests/SentryTests/Integrations/SessionReplay/SentryReplayRecordingTests.swift index 1441ac4b0fb..806a99d1259 100644 --- a/Tests/SentryTests/Integrations/SessionReplay/SentryReplayRecordingTests.swift +++ b/Tests/SentryTests/Integrations/SessionReplay/SentryReplayRecordingTests.swift @@ -1,5 +1,5 @@ import Foundation -@testable import Sentry +@_spi(Private) @testable import Sentry import XCTest class SentryReplayRecordingTests: XCTestCase { diff --git a/Tests/SentryTests/Integrations/SessionReplay/SentryReplayTypeTests.swift b/Tests/SentryTests/Integrations/SessionReplay/SentryReplayTypeTests.swift index 3e0a7ab7b3d..b53a1d417e6 100644 --- a/Tests/SentryTests/Integrations/SessionReplay/SentryReplayTypeTests.swift +++ b/Tests/SentryTests/Integrations/SessionReplay/SentryReplayTypeTests.swift @@ -1,4 +1,4 @@ -@testable import Sentry +@_spi(Private) @testable import Sentry import XCTest class SentryReplayTypeTests: XCTestCase { diff --git a/Tests/SentryTests/Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift b/Tests/SentryTests/Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift index bcac44b2ca7..d0023839e30 100644 --- a/Tests/SentryTests/Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift +++ b/Tests/SentryTests/Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift @@ -1,6 +1,6 @@ import Foundation -@testable import Sentry -import SentryTestUtils +@_spi(Private) @testable import Sentry +@_spi(Private) import SentryTestUtils import XCTest #if os(iOS) || os(tvOS) diff --git a/Tests/SentryTests/Integrations/SessionReplay/SentrySessionReplayTests.swift b/Tests/SentryTests/Integrations/SessionReplay/SentrySessionReplayTests.swift index 25895848f6d..bab8cf2d0d6 100644 --- a/Tests/SentryTests/Integrations/SessionReplay/SentrySessionReplayTests.swift +++ b/Tests/SentryTests/Integrations/SessionReplay/SentrySessionReplayTests.swift @@ -1,6 +1,6 @@ import Foundation -@testable import Sentry -import SentryTestUtils +@_spi(Private) @testable import Sentry +@_spi(Private) import SentryTestUtils import XCTest #if os(iOS) || os(tvOS) diff --git a/Tests/SentryTests/Networking/SentryHttpTransportTests.swift b/Tests/SentryTests/Networking/SentryHttpTransportTests.swift index e9513699d2c..5f8901da925 100644 --- a/Tests/SentryTests/Networking/SentryHttpTransportTests.swift +++ b/Tests/SentryTests/Networking/SentryHttpTransportTests.swift @@ -1,5 +1,5 @@ -@testable import Sentry -import SentryTestUtils +@_spi(Private) @testable import Sentry +@_spi(Private) import SentryTestUtils import XCTest // swiftlint:disable file_length diff --git a/Tests/SentryTests/Networking/SentrySpotlightTransportTests.swift b/Tests/SentryTests/Networking/SentrySpotlightTransportTests.swift index 4d48c65cc71..8f0b640c2f8 100644 --- a/Tests/SentryTests/Networking/SentrySpotlightTransportTests.swift +++ b/Tests/SentryTests/Networking/SentrySpotlightTransportTests.swift @@ -1,4 +1,4 @@ -@testable import Sentry +@_spi(Private) @testable import Sentry import SentryTestUtils import XCTest diff --git a/Tests/SentryTests/SentryClientTests.swift b/Tests/SentryTests/SentryClientTests.swift index 8361473f3ac..000d024b25f 100644 --- a/Tests/SentryTests/SentryClientTests.swift +++ b/Tests/SentryTests/SentryClientTests.swift @@ -1,4 +1,4 @@ -@testable import Sentry +@_spi(Private) @testable import Sentry import SentryTestUtils import XCTest diff --git a/Tests/SentryTests/SentryCrash/SentryCrashStackCursorSelfThreadTests.swift b/Tests/SentryTests/SentryCrash/SentryCrashStackCursorSelfThreadTests.swift index 51cead22f8d..a485506995b 100644 --- a/Tests/SentryTests/SentryCrash/SentryCrashStackCursorSelfThreadTests.swift +++ b/Tests/SentryTests/SentryCrash/SentryCrashStackCursorSelfThreadTests.swift @@ -1,4 +1,4 @@ -@testable import Sentry +@_spi(Private) @testable import Sentry import XCTest final class SentryCrashStackCursorSelfThreadTests: XCTestCase { diff --git a/Tests/SentryTests/SentryHubTests.swift b/Tests/SentryTests/SentryHubTests.swift index d1700f2386a..db16f0f739b 100644 --- a/Tests/SentryTests/SentryHubTests.swift +++ b/Tests/SentryTests/SentryHubTests.swift @@ -1,5 +1,5 @@ -@testable import Sentry -import SentryTestUtils +@_spi(Private) @testable import Sentry +@_spi(Private) import SentryTestUtils import XCTest // swiftlint:disable file_length diff --git a/Tests/SentryTests/SentrySDKTests.swift b/Tests/SentryTests/SentrySDKTests.swift index e8028a5e6cc..03f7e3ba66b 100644 --- a/Tests/SentryTests/SentrySDKTests.swift +++ b/Tests/SentryTests/SentrySDKTests.swift @@ -1,5 +1,5 @@ -@testable import Sentry -import SentryTestUtils +@_spi(Private) @testable import Sentry +@_spi(Private) import SentryTestUtils import XCTest // swiftlint:disable file_length diff --git a/Tests/SentryTests/SwiftDescriptorTests.swift b/Tests/SentryTests/SwiftDescriptorTests.swift index 2e6f5a08127..50a9546963d 100644 --- a/Tests/SentryTests/SwiftDescriptorTests.swift +++ b/Tests/SentryTests/SwiftDescriptorTests.swift @@ -1,4 +1,4 @@ -@testable import Sentry +@_spi(Private) @testable import Sentry import XCTest class SwiftDescriptorTests: XCTestCase { diff --git a/Tests/SentryTests/TestUtils/TestConncurrentModifications.swift b/Tests/SentryTests/TestUtils/TestConncurrentModifications.swift index 5c6fb6ae5fd..cd2c51d7705 100644 --- a/Tests/SentryTests/TestUtils/TestConncurrentModifications.swift +++ b/Tests/SentryTests/TestUtils/TestConncurrentModifications.swift @@ -1,5 +1,6 @@ import Foundation -import SentryTestUtils +@_spi(Private) import Sentry +@_spi(Private) import SentryTestUtils func testConcurrentModifications(asyncWorkItems: Int = 5, writeLoopCount: Int = 1_000, writeWork: @escaping (Int) -> Void, readWork: @escaping () -> Void = {}) { // To not spam the test logs diff --git a/Tests/SentryTests/Transaction/SentrySpanTests.swift b/Tests/SentryTests/Transaction/SentrySpanTests.swift index a6744adb8e6..a757fbbd8b3 100644 --- a/Tests/SentryTests/Transaction/SentrySpanTests.swift +++ b/Tests/SentryTests/Transaction/SentrySpanTests.swift @@ -1,4 +1,4 @@ -@testable import Sentry +@_spi(Private) @testable import Sentry import SentryTestUtils import XCTest diff --git a/Tests/SentryTests/Transaction/SentryTracerTests.swift b/Tests/SentryTests/Transaction/SentryTracerTests.swift index 6ebf46b62eb..7795242107d 100644 --- a/Tests/SentryTests/Transaction/SentryTracerTests.swift +++ b/Tests/SentryTests/Transaction/SentryTracerTests.swift @@ -1,6 +1,6 @@ import _SentryPrivate -@testable import Sentry -import SentryTestUtils +@_spi(Private) @testable import Sentry +@_spi(Private) import SentryTestUtils import XCTest // swiftlint:disable file_length diff --git a/Tests/SentryTests/URLSessionTaskHelperTests.swift b/Tests/SentryTests/URLSessionTaskHelperTests.swift index c40f93548ec..3a7f72c68b3 100644 --- a/Tests/SentryTests/URLSessionTaskHelperTests.swift +++ b/Tests/SentryTests/URLSessionTaskHelperTests.swift @@ -1,5 +1,5 @@ import Foundation -@testable import Sentry +@_spi(Private) @testable import Sentry import XCTest final class URLSessionTaskHelperTests: XCTestCase { diff --git a/Tests/SentryTests/UrlSanitizedTests.swift b/Tests/SentryTests/UrlSanitizedTests.swift index 2d46b7b5c30..cea22bb1801 100644 --- a/Tests/SentryTests/UrlSanitizedTests.swift +++ b/Tests/SentryTests/UrlSanitizedTests.swift @@ -1,5 +1,5 @@ import Foundation -@testable import Sentry +@_spi(Private) @testable import Sentry import XCTest class UrlSanitizedTests: XCTestCase { diff --git a/develop-docs/README.md b/develop-docs/README.md index 61da01c908a..a5f99e00130 100644 --- a/develop-docs/README.md +++ b/develop-docs/README.md @@ -228,6 +228,10 @@ When making an Objective-C class public for Swift SDK code, do the following: - Add the import `@_implementationOnly import _SentryPrivate` to your Swift class that wants to use the Objective-C class. +To make internal Swift code accessible to ObjC it needs to be `public`. This allows the ObjC header to be generated by Swift Package Manager. +To discourage use outside of the SDK, add `@_spi(Private)` to these declarations. This ensures they can only be used when the import also +adds the SPI attribute. + ## Public Protocols pod lib lint fails with the warning duplicate protocol definition when including a public header for