From 701ae84f2d80fb21c72974fda7adc0f28597f339 Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Tue, 22 Feb 2022 12:55:24 -0800 Subject: [PATCH 1/4] chore: ref #129 Release v2.0.3 --- CHANGELOG.md | 6 ++++++ RollbarAUL.podspec | 2 +- RollbarCommon.podspec | 2 +- RollbarDeploys.podspec | 2 +- RollbarKSCrash.podspec | 2 +- RollbarNotifier.podspec | 2 +- .../RollbarNotifier/DTOs/RollbarConfig.m | 17 ++--------------- RollbarPLCrashReporter.podspec | 2 +- RollbarSDK.experimental_podspec | 2 +- RollbarSwift.podspec | 2 +- 10 files changed, 16 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7ca6382..c4b9c673 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,12 @@ The change log has moved to this repo's [GitHub Releases Page](https://github.co ## Release Notes +**2.0.3 +- docs: resolve #122 - Update RollbarCommon public API doc comments so they are properly rendered by Xcode Quick Help +- docs: resolve #124 - Update RollbarDeploys public API doc comments so they are properly rendered by Xcode Quick Help +- docs: resolve #126 - Update RollbarSwift, RollbarAUL, RollbarPLCrashReporter, and RollbarKSCrash public API doc comments so they are properly rendered by Xcode Quick Help +- docs: resolve #127 - Update RollbarNotifier public API doc comments so they are properly rendered by Xcode Quick Help + **2.0.2 - fix: resolve #110 - Xcode autocomplete for Swift expects person.id, but codebase expects person.ID - chore: resolve #118 - Remove source file header comments from RollbarCommon diff --git a/RollbarAUL.podspec b/RollbarAUL.podspec index fb60ef71..c7552930 100644 --- a/RollbarAUL.podspec +++ b/RollbarAUL.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| - s.version = "2.0.2" + s.version = "2.0.3" s.name = "RollbarAUL" s.summary = "Application or client side SDK for interacting with the Rollbar API Server." s.description = <<-DESC diff --git a/RollbarCommon.podspec b/RollbarCommon.podspec index dbc9c9a9..d11d958c 100644 --- a/RollbarCommon.podspec +++ b/RollbarCommon.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| - s.version = "2.0.2" + s.version = "2.0.3" s.name = "RollbarCommon" s.summary = "Application or client side SDK for interacting with the Rollbar API Server." s.description = <<-DESC diff --git a/RollbarDeploys.podspec b/RollbarDeploys.podspec index 375b72bb..a75824d2 100644 --- a/RollbarDeploys.podspec +++ b/RollbarDeploys.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| - s.version = "2.0.2" + s.version = "2.0.3" s.name = "RollbarDeploys" s.summary = "Application or client side SDK for interacting with the Rollbar API Server." s.description = <<-DESC diff --git a/RollbarKSCrash.podspec b/RollbarKSCrash.podspec index 00b4f3a7..d78836aa 100644 --- a/RollbarKSCrash.podspec +++ b/RollbarKSCrash.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| - s.version = "2.0.2" + s.version = "2.0.3" s.name = "RollbarKSCrash" s.summary = "Application or client side SDK for interacting with the Rollbar API Server." s.description = <<-DESC diff --git a/RollbarNotifier.podspec b/RollbarNotifier.podspec index 3b3fdc18..1c38bf94 100644 --- a/RollbarNotifier.podspec +++ b/RollbarNotifier.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| - s.version = "2.0.2" + s.version = "2.0.3" s.name = "RollbarNotifier" s.summary = "Application or client side SDK for interacting with the Rollbar API Server." s.description = <<-DESC diff --git a/RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarConfig.m b/RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarConfig.m index 86370d4b..0ddb117f 100644 --- a/RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarConfig.m +++ b/RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarConfig.m @@ -14,34 +14,26 @@ #pragma mark - constants -static NSString * const NOTIFIER_VERSION = @"2.0.2"; +static NSString * const NOTIFIER_VERSION = @"2.0.3"; static NSString * const NOTIFIER_NAME = @"rollbar-apple"; #define NOTIFIER_NAME_PREFIX = @"rollbar-"; + #if TARGET_OS_IPHONE | TARGET_OS_IOS static NSString * const OPERATING_SYSTEM = @"ios"; -//static NSString * const NOTIFIER_NAME = @"rollbar-ios"; #elif TARGET_OS_OSX static NSString * const OPERATING_SYSTEM = @"macos"; -//static NSString * const NOTIFIER_NAME = @"rollbar-macos"; #elif TARGET_OS_TV static NSString * const OPERATING_SYSTEM = @"tvos"; -//static NSString * const NOTIFIER_NAME = @"rollbar-tvos"; #elif TARGET_OS_WATCH static NSString * const OPERATING_SYSTEM = @"watchos"; -//static NSString * const NOTIFIER_NAME = @"rollbar-watchos"; #else static NSString * const OPERATING_SYSTEM = @"*os"; -//static NSString * const NOTIFIER_NAME = @"rollbar-*os"; #endif -//static NSString * const CONFIGURATION_FILENAME = @"rollbar.config"; - #pragma mark - static data -//static NSString *configurationFilePath = nil; - #pragma mark - data fields static NSString * const DFK_DESTINATION = @"destination"; @@ -63,10 +55,6 @@ @implementation RollbarConfig #pragma mark - initializers - (instancetype)init { -// if (!configurationFilePath) { -// NSString *cachesDirectory = [RollbarCachesDirectory directory]; -// configurationFilePath = [cachesDirectory stringByAppendingPathComponent:CONFIGURATION_FILENAME]; -// } self = [super initWithDictionary:@{ DFK_DESTINATION:[RollbarDestination new].jsonFriendlyData, @@ -81,7 +69,6 @@ - (instancetype)init { DFK_PERSON: [NSMutableDictionary new], DFK_CUSTOM: [NSMutableDictionary new] }]; - //[self save]; return self; } diff --git a/RollbarPLCrashReporter.podspec b/RollbarPLCrashReporter.podspec index 6d15a674..8861d503 100644 --- a/RollbarPLCrashReporter.podspec +++ b/RollbarPLCrashReporter.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| - s.version = "2.0.2" + s.version = "2.0.3" s.name = "RollbarPLCrashReporter" s.summary = "Application or client side SDK for interacting with the Rollbar API Server." s.description = <<-DESC diff --git a/RollbarSDK.experimental_podspec b/RollbarSDK.experimental_podspec index 17b36a38..d61a9a4b 100644 --- a/RollbarSDK.experimental_podspec +++ b/RollbarSDK.experimental_podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |sdk| # Rollbar SDK: # ============ - sdk.version = "2.0.2" + sdk.version = "2.0.3" sdk.name = "RollbarSDK" s.summary = "Application or client side SDK for interacting with the Rollbar API Server." sdk.description = <<-DESC diff --git a/RollbarSwift.podspec b/RollbarSwift.podspec index fcf94899..786dac9c 100644 --- a/RollbarSwift.podspec +++ b/RollbarSwift.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| - s.version = "2.0.2" + s.version = "2.0.3" s.name = "RollbarSwift" s.summary = "Application or client side SDK for interacting with the Rollbar API Server." s.description = <<-DESC From 77ab6aa8cc19cd20476f60db0b9a81fff479337d Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Tue, 22 Feb 2022 18:18:08 -0800 Subject: [PATCH 2/4] chore: resolve #114 Consolidate destination parameters for samples --- Demos/RollbarDemoSettings.h | 16 ++++++++++++++++ Demos/RollbarDemoSettings.swift | 8 ++++++++ .../iosAppObjC.xcodeproj/project.pbxproj | 2 ++ Demos/iosAppObjC/iosAppObjC/AppDelegate.m | 12 ++++++++---- Demos/iosAppObjC/iosAppObjC/SceneDelegate.m | 4 +++- .../macosAppObjC.xcodeproj/project.pbxproj | 2 ++ Demos/macosAppObjC/macosAppObjC/AppDelegate.m | 5 +++-- .../macosAppObjC/RollbarDeploysDemoClient.m | 17 +++++++++-------- .../macosAppSwift.xcodeproj/project.pbxproj | 4 ++++ .../macosAppSwift/ContentView.swift | 8 ++++++-- RollbarSDK.xcworkspace/contents.xcworkspacedata | 6 ++++++ 11 files changed, 67 insertions(+), 17 deletions(-) create mode 100644 Demos/RollbarDemoSettings.h create mode 100644 Demos/RollbarDemoSettings.swift diff --git a/Demos/RollbarDemoSettings.h b/Demos/RollbarDemoSettings.h new file mode 100644 index 00000000..500f5201 --- /dev/null +++ b/Demos/RollbarDemoSettings.h @@ -0,0 +1,16 @@ +#ifndef RollbarDemoSettings_h +#define RollbarDemoSettings_h + +static NSString * const ROLLBAR_DEMO_ENVIRONMENT = +@"Rollbar-Apple-Samples"; + +static NSString * const ROLLBAR_DEMO_PAYLOADS_ACCESS_TOKEN = +@"09da180aba21479e9ed3d91e0b8d58d6"; + +static NSString * const ROLLBAR_DEMO_DEPLOYS_WRITE_ACCESS_TOKEN = +@"efdc4b85d66045f293a7f9e99c732f61"; + +static NSString * const ROLLBAR_DEMO_DEPLOYS_READ_ACCESS_TOKEN = +@"595cbf76b05b45f2b3ef661a2e0078d4"; + +#endif /* RollbarDemoSettings_h */ diff --git a/Demos/RollbarDemoSettings.swift b/Demos/RollbarDemoSettings.swift new file mode 100644 index 00000000..870e65a3 --- /dev/null +++ b/Demos/RollbarDemoSettings.swift @@ -0,0 +1,8 @@ +import Foundation + +struct RollbarDemoSettings { + static let environment = "Rollbar-Apple-Samples"; + static let payloadsPostAccessToken = "09da180aba21479e9ed3d91e0b8d58d6"; + static let deploysWriteAccessToken = "efdc4b85d66045f293a7f9e99c732f61"; + static let deploysReadAccessToken = "595cbf76b05b45f2b3ef661a2e0078d4"; +} diff --git a/Demos/iosAppObjC/iosAppObjC.xcodeproj/project.pbxproj b/Demos/iosAppObjC/iosAppObjC.xcodeproj/project.pbxproj index d9f7b84e..f1d417ec 100644 --- a/Demos/iosAppObjC/iosAppObjC.xcodeproj/project.pbxproj +++ b/Demos/iosAppObjC/iosAppObjC.xcodeproj/project.pbxproj @@ -36,6 +36,7 @@ 55684F802553B4C700F82F34 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 55684F9B2553BD1B00F82F34 /* iosAppObjC.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = iosAppObjC.entitlements; sourceTree = ""; }; 55684F9C2553BD1C00F82F34 /* NetworkExtension.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NetworkExtension.framework; path = System/Library/Frameworks/NetworkExtension.framework; sourceTree = SDKROOT; }; + 55C1B42127C5C95000017B22 /* RollbarDemoSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RollbarDemoSettings.h; path = ../../RollbarDemoSettings.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -74,6 +75,7 @@ 55684F6D2553B4C400F82F34 /* iosAppObjC */ = { isa = PBXGroup; children = ( + 55C1B42127C5C95000017B22 /* RollbarDemoSettings.h */, 55684F9B2553BD1B00F82F34 /* iosAppObjC.entitlements */, 55684F6E2553B4C400F82F34 /* AppDelegate.h */, 55684F6F2553B4C400F82F34 /* AppDelegate.m */, diff --git a/Demos/iosAppObjC/iosAppObjC/AppDelegate.m b/Demos/iosAppObjC/iosAppObjC/AppDelegate.m index a840090b..2825441f 100644 --- a/Demos/iosAppObjC/iosAppObjC/AppDelegate.m +++ b/Demos/iosAppObjC/iosAppObjC/AppDelegate.m @@ -6,6 +6,7 @@ // #import "AppDelegate.h" +#import "RollbarDemoSettings.h" @import RollbarNotifier; @import RollbarKSCrash; @@ -55,14 +56,17 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( #pragma mark - UISceneSession lifecycle -- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options { +- (UISceneConfiguration *) application:(UIApplication *)application +configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession + options:(UISceneConnectionOptions *)options { // Called when a new scene session is being created. // Use this method to select a configuration to create the new scene with. return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role]; } -- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet *)sceneSessions { +- (void) application:(UIApplication *)application +didDiscardSceneSessions:(NSSet *)sceneSessions { // Called when the user discards a scene session. // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. // Use this method to release any resources that were specific to the discarded scenes, as they will not return. @@ -73,8 +77,8 @@ - (void)initRollbar { // configure Rollbar: RollbarConfig *config = [RollbarConfig new]; - config.destination.accessToken = @"09da180aba21479e9ed3d91e0b8d58d6"; - config.destination.environment = @"Rollbar-Apple-Samples"; + config.destination.accessToken = ROLLBAR_DEMO_PAYLOADS_ACCESS_TOKEN; + config.destination.environment = ROLLBAR_DEMO_ENVIRONMENT; config.customData = @{ @"someKey": @"someValue", }; // init Rollbar shared instance: diff --git a/Demos/iosAppObjC/iosAppObjC/SceneDelegate.m b/Demos/iosAppObjC/iosAppObjC/SceneDelegate.m index dc2772c0..35cbd6aa 100644 --- a/Demos/iosAppObjC/iosAppObjC/SceneDelegate.m +++ b/Demos/iosAppObjC/iosAppObjC/SceneDelegate.m @@ -14,7 +14,9 @@ @interface SceneDelegate () @implementation SceneDelegate -- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { +- (void) scene:(UIScene *)scene + willConnectToSession:(UISceneSession *)session + options:(UISceneConnectionOptions *)connectionOptions { // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). diff --git a/Demos/macosAppObjC/macosAppObjC.xcodeproj/project.pbxproj b/Demos/macosAppObjC/macosAppObjC.xcodeproj/project.pbxproj index 01fd1f83..b146ba04 100644 --- a/Demos/macosAppObjC/macosAppObjC.xcodeproj/project.pbxproj +++ b/Demos/macosAppObjC/macosAppObjC.xcodeproj/project.pbxproj @@ -31,6 +31,7 @@ 55759A772477561100ED3F04 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55759A782477561100ED3F04 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 55759A7A2477561100ED3F04 /* macosAppObjC.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = macosAppObjC.entitlements; sourceTree = ""; }; + 55C1B42027C5C4E800017B22 /* RollbarDemoSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RollbarDemoSettings.h; path = ../../RollbarDemoSettings.h; sourceTree = ""; }; 55FD07122478614B000BBC22 /* RollbarDeploysDemoClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RollbarDeploysDemoClient.h; sourceTree = ""; }; 55FD07132478614B000BBC22 /* RollbarDeploysDemoClient.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RollbarDeploysDemoClient.m; sourceTree = ""; }; /* End PBXFileReference section */ @@ -71,6 +72,7 @@ 55759A6B2477560D00ED3F04 /* macosAppObjC */ = { isa = PBXGroup; children = ( + 55C1B42027C5C4E800017B22 /* RollbarDemoSettings.h */, 55759A6C2477560D00ED3F04 /* AppDelegate.h */, 55759A6D2477560D00ED3F04 /* AppDelegate.m */, 55759A6F2477560D00ED3F04 /* ViewController.h */, diff --git a/Demos/macosAppObjC/macosAppObjC/AppDelegate.m b/Demos/macosAppObjC/macosAppObjC/AppDelegate.m index 965d633d..701b20c4 100644 --- a/Demos/macosAppObjC/macosAppObjC/AppDelegate.m +++ b/Demos/macosAppObjC/macosAppObjC/AppDelegate.m @@ -9,6 +9,7 @@ #import "AppDelegate.h" #import "RollbarDeploysDemoClient.h" +#import "RollbarDemoSettings.h" @import RollbarNotifier; @import RollbarAUL; @@ -77,8 +78,8 @@ - (void)initRollbar { // configure Rollbar: RollbarConfig *config = [RollbarConfig new]; - config.destination.accessToken = @"09da180aba21479e9ed3d91e0b8d58d6"; - config.destination.environment = @"Rollbar-Apple-Samples"; + config.destination.accessToken = ROLLBAR_DEMO_PAYLOADS_ACCESS_TOKEN; + config.destination.environment = ROLLBAR_DEMO_ENVIRONMENT; //config.developerOptions.suppressSdkInfoLogging = YES; config.customData = @{ @"someKey": @"someValue", }; diff --git a/Demos/macosAppObjC/macosAppObjC/RollbarDeploysDemoClient.m b/Demos/macosAppObjC/macosAppObjC/RollbarDeploysDemoClient.m index fff5945e..eb090c5e 100644 --- a/Demos/macosAppObjC/macosAppObjC/RollbarDeploysDemoClient.m +++ b/Demos/macosAppObjC/macosAppObjC/RollbarDeploysDemoClient.m @@ -7,6 +7,7 @@ // #import "RollbarDeploysDemoClient.h" +#import "RollbarDemoSettings.h" @import RollbarDeploys; @interface RollbarDeploysObserver @@ -57,11 +58,11 @@ - (void)demoDeploymentRegistration { NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; - NSString * const environment = @"Rollbar-Apple-UnitTests"; + NSString * const environment = ROLLBAR_DEMO_ENVIRONMENT; NSString * const comment = [NSString stringWithFormat:@"a new deploy at %@", [dateFormatter stringFromDate:[NSDate date]]]; NSString * const revision = @"a_revision"; - NSString * const localUsername = @"UnitTestRunner"; + NSString * const localUsername = @"DemosRunner"; NSString * const rollbarUsername = @"rollbar"; RollbarDeploysObserver *observer = [[RollbarDeploysObserver alloc] init]; @@ -71,8 +72,8 @@ - (void)demoDeploymentRegistration { localUserName:localUsername rollbarUserName:rollbarUsername]; RollbarDeploysManager *deploysManager = - [[RollbarDeploysManager alloc] initWithWriteAccessToken:@"efdc4b85d66045f293a7f9e99c732f61" - readAccessToken:@"595cbf76b05b45f2b3ef661a2e0078d4" + [[RollbarDeploysManager alloc] initWithWriteAccessToken:ROLLBAR_DEMO_DEPLOYS_WRITE_ACCESS_TOKEN + readAccessToken:ROLLBAR_DEMO_DEPLOYS_READ_ACCESS_TOKEN deploymentRegistrationObserver:observer deploymentDetailsObserver:observer deploymentDetailsPageObserver:observer @@ -85,8 +86,8 @@ - (void)demoGetDeploymentDetailsById { NSString * const testDeploymentId = @"23922850"; RollbarDeploysObserver *observer = [[RollbarDeploysObserver alloc] init]; RollbarDeploysManager *deploysManager = - [[RollbarDeploysManager alloc] initWithWriteAccessToken:@"efdc4b85d66045f293a7f9e99c732f61" - readAccessToken:@"595cbf76b05b45f2b3ef661a2e0078d4" + [[RollbarDeploysManager alloc] initWithWriteAccessToken:ROLLBAR_DEMO_DEPLOYS_WRITE_ACCESS_TOKEN + readAccessToken:ROLLBAR_DEMO_DEPLOYS_READ_ACCESS_TOKEN deploymentRegistrationObserver:observer deploymentDetailsObserver:observer deploymentDetailsPageObserver:observer @@ -98,8 +99,8 @@ - (void)demoGetDeploymentsPage { RollbarDeploysObserver *observer = [[RollbarDeploysObserver alloc] init]; RollbarDeploysManager *deploysManager = - [[RollbarDeploysManager alloc] initWithWriteAccessToken:@"efdc4b85d66045f293a7f9e99c732f61" - readAccessToken:@"595cbf76b05b45f2b3ef661a2e0078d4" + [[RollbarDeploysManager alloc] initWithWriteAccessToken:ROLLBAR_DEMO_DEPLOYS_WRITE_ACCESS_TOKEN + readAccessToken:ROLLBAR_DEMO_DEPLOYS_READ_ACCESS_TOKEN deploymentRegistrationObserver:observer deploymentDetailsObserver:observer deploymentDetailsPageObserver:observer diff --git a/Demos/macosAppSwift/macosAppSwift.xcodeproj/project.pbxproj b/Demos/macosAppSwift/macosAppSwift.xcodeproj/project.pbxproj index 45333629..5ae3ff3e 100644 --- a/Demos/macosAppSwift/macosAppSwift.xcodeproj/project.pbxproj +++ b/Demos/macosAppSwift/macosAppSwift.xcodeproj/project.pbxproj @@ -16,6 +16,7 @@ 5544A01F25FB074300C710A1 /* RollbarCommon in Frameworks */ = {isa = PBXBuildFile; productRef = 5544A01E25FB074300C710A1 /* RollbarCommon */; }; 5544A02125FB074300C710A1 /* RollbarNotifier in Frameworks */ = {isa = PBXBuildFile; productRef = 5544A02025FB074300C710A1 /* RollbarNotifier */; }; 5544A02325FB074300C710A1 /* RollbarSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 5544A02225FB074300C710A1 /* RollbarSwift */; }; + 55C1B41F27C5BDF000017B22 /* RollbarDemoSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C1B41E27C5BDF000017B22 /* RollbarDemoSettings.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -26,6 +27,7 @@ 55098C6B25FA93110045C180 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 55098C6D25FA93110045C180 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55098C6E25FA93110045C180 /* macosAppSwift.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = macosAppSwift.entitlements; sourceTree = ""; }; + 55C1B41E27C5BDF000017B22 /* RollbarDemoSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RollbarDemoSettings.swift; path = ../../RollbarDemoSettings.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -64,6 +66,7 @@ 55098C6325FA930D0045C180 /* macosAppSwift */ = { isa = PBXGroup; children = ( + 55C1B41E27C5BDF000017B22 /* RollbarDemoSettings.swift */, 55098C6425FA930D0045C180 /* macosAppSwiftApp.swift */, 55098C6625FA930D0045C180 /* ContentView.swift */, 55098C6825FA93110045C180 /* Assets.xcassets */, @@ -166,6 +169,7 @@ buildActionMask = 2147483647; files = ( 55098C6725FA930D0045C180 /* ContentView.swift in Sources */, + 55C1B41F27C5BDF000017B22 /* RollbarDemoSettings.swift in Sources */, 55098C6525FA930D0045C180 /* macosAppSwiftApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Demos/macosAppSwift/macosAppSwift/ContentView.swift b/Demos/macosAppSwift/macosAppSwift/ContentView.swift index bcb22487..d412e9b5 100644 --- a/Demos/macosAppSwift/macosAppSwift/ContentView.swift +++ b/Demos/macosAppSwift/macosAppSwift/ContentView.swift @@ -91,8 +91,12 @@ func handleSwiftError() { func createGuard() -> RollbarExceptionGuard { let config = RollbarConfig(); - config.destination.accessToken = "09da180aba21479e9ed3d91e0b8d58d6"; - config.destination.environment = "Rollbar-Apple-Samples"; + + config.destination.accessToken = + RollbarDemoSettings.payloadsPostAccessToken; + + config.destination.environment = + RollbarDemoSettings.environment; // AUL capture setup: // config.developerOptions.transmit = true; diff --git a/RollbarSDK.xcworkspace/contents.xcworkspacedata b/RollbarSDK.xcworkspace/contents.xcworkspacedata index d82c07e1..0c3fe25f 100644 --- a/RollbarSDK.xcworkspace/contents.xcworkspacedata +++ b/RollbarSDK.xcworkspace/contents.xcworkspacedata @@ -77,6 +77,12 @@ + + + + From 507333e3571101cd6631f95dd63b8becad9498d5 Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Wed, 23 Feb 2022 00:59:35 -0800 Subject: [PATCH 3/4] chore: ref #113 Consolidate destination parameters for unit tests --- CHANGELOG.md | 2 + RollbarAUL/Package.swift | 16 +++--- .../RollbarAulStoreMonitorTest.m | 5 +- RollbarCommon/Package.swift | 8 ++- RollbarDeploys/Package.swift | 9 ++- .../RollbarDeploysTests.m | 17 +++--- .../RollbarDeploysTests.swift | 55 ++++++++++--------- RollbarKSCrash/Package.swift | 16 +++--- RollbarNotifier/Package.swift | 14 ++--- .../PayloadTruncationTests.m | 5 +- .../RollbarConfigurationTests.m | 3 +- .../RollbarTelemetryTests.m | 5 +- .../RollbarNotifierTests-ObjC/RollbarTests.m | 9 +-- .../RollbarNotifierConfigurationTests.swift | 2 +- .../RollbarNotifierLoggerTests.swift | 11 ++-- .../RollbarNotifierTelemetryTests.swift | 5 +- .../RollbarNotifierTruncationTests.swift | 5 +- RollbarPLCrashReporter/Package.swift | 16 +++--- .../contents.xcworkspacedata | 10 ++++ RollbarSwift/Package.swift | 16 +++--- .../RollbarSwiftTests/RollbarSwiftTests.swift | 5 +- UnitTesting/.gitignore | 7 +++ UnitTesting/Package.swift | 28 ++++++++++ UnitTesting/README.md | 3 + .../UnitTesting/RollbarUnitTestSettings.swift | 8 +++ .../UnitTestingTests/UnitTestingTests.swift | 11 ++++ UnitTests/RollbarUnitTestSettings.h | 16 ++++++ 27 files changed, 200 insertions(+), 107 deletions(-) create mode 100644 UnitTesting/.gitignore create mode 100644 UnitTesting/Package.swift create mode 100644 UnitTesting/README.md create mode 100644 UnitTesting/Sources/UnitTesting/RollbarUnitTestSettings.swift create mode 100644 UnitTesting/Tests/UnitTestingTests/UnitTestingTests.swift create mode 100644 UnitTests/RollbarUnitTestSettings.h diff --git a/CHANGELOG.md b/CHANGELOG.md index c4b9c673..b4f2751d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,8 @@ The change log has moved to this repo's [GitHub Releases Page](https://github.co - docs: resolve #124 - Update RollbarDeploys public API doc comments so they are properly rendered by Xcode Quick Help - docs: resolve #126 - Update RollbarSwift, RollbarAUL, RollbarPLCrashReporter, and RollbarKSCrash public API doc comments so they are properly rendered by Xcode Quick Help - docs: resolve #127 - Update RollbarNotifier public API doc comments so they are properly rendered by Xcode Quick Help +- chore: resolve #114 - Consolidate destination parameters for samples +- chore: resolve #113 - Consolidate destination parameters for unit tests **2.0.2 - fix: resolve #110 - Xcode autocomplete for Swift expects person.id, but codebase expects person.ID diff --git a/RollbarAUL/Package.swift b/RollbarAUL/Package.swift index bc0998d0..3cf02f7b 100644 --- a/RollbarAUL/Package.swift +++ b/RollbarAUL/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.3 +// swift-tools-version:5.5 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -23,6 +23,9 @@ let package = Package( // .package(url: /* package url */, from: "1.0.0"), .package(path: "../RollbarCommon"), .package(path: "../RollbarNotifier"), + .package(name: "UnitTesting", + path: "../UnitTesting" + ), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. @@ -42,14 +45,9 @@ let package = Package( ), .testTarget( name: "RollbarAULTests", - dependencies: ["RollbarAUL"], - cSettings: [ - .headerSearchPath("Tests/RollbarAULTests/**"), -// .headerSearchPath("Sources/RollbarNotifier"), -// .headerSearchPath("Sources/RollbarNotifier/include"), -// .headerSearchPath("Sources/RollbarNotifier/DTOs"), - -// .define("DEFINES_MODULE"), + dependencies: [ + "UnitTesting", + "RollbarAUL", ] ), .testTarget( diff --git a/RollbarAUL/Tests/RollbarAULTests-ObjC/RollbarAulStoreMonitorTest.m b/RollbarAUL/Tests/RollbarAULTests-ObjC/RollbarAulStoreMonitorTest.m index 6a9dc1a2..a656070e 100644 --- a/RollbarAUL/Tests/RollbarAULTests-ObjC/RollbarAulStoreMonitorTest.m +++ b/RollbarAUL/Tests/RollbarAULTests-ObjC/RollbarAulStoreMonitorTest.m @@ -15,6 +15,7 @@ #if !TARGET_OS_WATCH #import +#import "../../../UnitTests/RollbarUnitTestSettings.h" @import RollbarNotifier; @import RollbarAUL; @@ -62,8 +63,8 @@ - (void)generateLogEntries { //- (void)testRollbarAulStoreMonitor { // // RollbarConfig *rollbarConfig = [[RollbarConfig alloc] init]; -// rollbarConfig.destination.accessToken = @"efdc4b85d66045f293a7f9e99c732f61"; -// rollbarConfig.destination.environment = @"Rollbar-Apple-UnitTests"; +// rollbarConfig.destination.accessToken = ROLLBAR_UNIT_TEST_DEPLOYS_WRITE_ACCESS_TOKEN; +// rollbarConfig.destination.environment = ROLLBAR_UNIT_TEST_ENVIRONMENT; // rollbarConfig.telemetry.enabled = YES; // rollbarConfig.telemetry.captureLog = YES; // rollbarConfig.telemetry.maximumTelemetryData = 100; diff --git a/RollbarCommon/Package.swift b/RollbarCommon/Package.swift index fba26b6a..97da63bb 100644 --- a/RollbarCommon/Package.swift +++ b/RollbarCommon/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.2 +// swift-tools-version:5.5 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -29,6 +29,7 @@ let package = Package( dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), + .package(path: "../UnitTesting"), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. @@ -48,7 +49,10 @@ let package = Package( ), .testTarget( name: "RollbarCommonTests", - dependencies: ["RollbarCommon"] + dependencies: [ + "UnitTesting", + "RollbarCommon", + ] ), .testTarget( name: "RollbarCommonTests-ObjC", diff --git a/RollbarDeploys/Package.swift b/RollbarDeploys/Package.swift index d415e388..51740e02 100644 --- a/RollbarDeploys/Package.swift +++ b/RollbarDeploys/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.2 +// swift-tools-version:5.5 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -22,6 +22,7 @@ let package = Package( // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), .package(path: "../RollbarCommon"), + .package(path: "../UnitTesting"), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. @@ -41,7 +42,11 @@ let package = Package( ), .testTarget( name: "RollbarDeploysTests", - dependencies: ["RollbarDeploys"]), + dependencies: [ + "UnitTesting", + "RollbarDeploys", + ] + ), .testTarget( name: "RollbarDeploysTests-ObjC", dependencies: ["RollbarDeploys"], diff --git a/RollbarDeploys/Tests/RollbarDeploysTests-ObjC/RollbarDeploysTests.m b/RollbarDeploys/Tests/RollbarDeploysTests-ObjC/RollbarDeploysTests.m index 1068fb38..7b6e8360 100644 --- a/RollbarDeploys/Tests/RollbarDeploysTests-ObjC/RollbarDeploysTests.m +++ b/RollbarDeploys/Tests/RollbarDeploysTests-ObjC/RollbarDeploysTests.m @@ -1,6 +1,7 @@ // Copyright (c) 2018 Rollbar, Inc. All rights reserved. #import +#import "../../../UnitTests/RollbarUnitTestSettings.h" @import RollbarDeploys; @@ -48,7 +49,7 @@ @interface RollbarDeploysTests : XCTestCase @implementation RollbarDeploysTests - (void)testDeploymentDto { - NSString * const environment = @"Rollbar-Apple-UnitTests"; + NSString * const environment = ROLLBAR_UNIT_TEST_ENVIRONMENT; NSString * const comment = @"a new deploy"; NSString * const revision = @"a_revision"; NSString * const localUsername = @"UnitTestRunner"; @@ -77,7 +78,7 @@ - (void)testDeploymentRegistration { NSDateFormatter *dateFormatter=[[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; - NSString * const environment = @"Rollbar-Apple-UnitTests"; + NSString * const environment = ROLLBAR_UNIT_TEST_ENVIRONMENT; NSString * const comment = [NSString stringWithFormat:@"a new deploy at %@", [dateFormatter stringFromDate:[NSDate date]]]; NSString * const revision = @"a_revision"; @@ -91,8 +92,8 @@ - (void)testDeploymentRegistration { localUserName:localUsername rollbarUserName:rollbarUsername]; RollbarDeploysManager *deploysManager = - [[RollbarDeploysManager alloc] initWithWriteAccessToken:@"efdc4b85d66045f293a7f9e99c732f61" - readAccessToken:@"595cbf76b05b45f2b3ef661a2e0078d4" + [[RollbarDeploysManager alloc] initWithWriteAccessToken:ROLLBAR_UNIT_TEST_DEPLOYS_WRITE_ACCESS_TOKEN + readAccessToken:ROLLBAR_UNIT_TEST_DEPLOYS_READ_ACCESS_TOKEN deploymentRegistrationObserver:observer deploymentDetailsObserver:observer deploymentDetailsPageObserver:observer @@ -104,8 +105,8 @@ - (void)testGetDeploymentDetailsById { NSString * const testDeploymentId = @"23922850"; RollbarDeploysObserver *observer = [[RollbarDeploysObserver alloc] init]; RollbarDeploysManager *deploysManager = - [[RollbarDeploysManager alloc] initWithWriteAccessToken:@"efdc4b85d66045f293a7f9e99c732f61" - readAccessToken:@"595cbf76b05b45f2b3ef661a2e0078d4" + [[RollbarDeploysManager alloc] initWithWriteAccessToken:ROLLBAR_UNIT_TEST_DEPLOYS_WRITE_ACCESS_TOKEN + readAccessToken:ROLLBAR_UNIT_TEST_DEPLOYS_READ_ACCESS_TOKEN deploymentRegistrationObserver:observer deploymentDetailsObserver:observer deploymentDetailsPageObserver:observer @@ -116,8 +117,8 @@ - (void)testGetDeploymentDetailsById { - (void)testGetDeploymentsPage { RollbarDeploysObserver *observer = [[RollbarDeploysObserver alloc] init]; RollbarDeploysManager *deploysManager = - [[RollbarDeploysManager alloc] initWithWriteAccessToken:@"efdc4b85d66045f293a7f9e99c732f61" - readAccessToken:@"595cbf76b05b45f2b3ef661a2e0078d4" + [[RollbarDeploysManager alloc] initWithWriteAccessToken:ROLLBAR_UNIT_TEST_DEPLOYS_WRITE_ACCESS_TOKEN + readAccessToken:ROLLBAR_UNIT_TEST_DEPLOYS_READ_ACCESS_TOKEN deploymentRegistrationObserver:observer deploymentDetailsObserver:observer deploymentDetailsPageObserver:observer diff --git a/RollbarDeploys/Tests/RollbarDeploysTests/RollbarDeploysTests.swift b/RollbarDeploys/Tests/RollbarDeploysTests/RollbarDeploysTests.swift index d2456636..74a304e5 100644 --- a/RollbarDeploys/Tests/RollbarDeploysTests/RollbarDeploysTests.swift +++ b/RollbarDeploys/Tests/RollbarDeploysTests/RollbarDeploysTests.swift @@ -1,16 +1,17 @@ import XCTest import Foundation +import UnitTesting @testable import RollbarDeploys final class RollbarDeploysTests: XCTestCase { func testDeploymentDto() { - let environment = "Rollbar-Apple-UnitTests" - let comment = "a new deploy" - let revision = "a_revision" - let localUsername = "UnitTestRunner" - let rollbarUsername = "rollbar" + let environment = RollbarUnitTestSettings.environment; + let comment = "a new deploy"; + let revision = "a_revision"; + let localUsername = "UnitTestRunner"; + let rollbarUsername = "rollbar"; let deployment = RollbarDeployment( environment:environment, @@ -18,7 +19,7 @@ final class RollbarDeploysTests: XCTestCase { revision:revision, localUserName:localUsername, rollbarUserName:rollbarUsername - ) + ); XCTAssertTrue(nil != deployment) @@ -40,13 +41,13 @@ final class RollbarDeploysTests: XCTestCase { let dateFormatter = DateFormatter() dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" - let environment = "Rollbar-Apple-UnitTests" - let comment = "a new deploy at \(dateFormatter.string(from:Date.init()))" - let revision = "a_revision" - let localUsername = "UnitTestRunner" - let rollbarUsername = "rollbar" + let environment = RollbarUnitTestSettings.environment; + let comment = "a new deploy at \(dateFormatter.string(from:Date.init()))"; + let revision = "a_revision"; + let localUsername = "UnitTestRunner"; + let rollbarUsername = "rollbar"; - let observer = RollbarDeploysObserver() + let observer = RollbarDeploysObserver(); let deployment = RollbarDeployment( environment:environment, @@ -54,17 +55,17 @@ final class RollbarDeploysTests: XCTestCase { revision:revision, localUserName:localUsername, rollbarUserName:rollbarUsername - ) + ); let deploysManager = RollbarDeploysManager( - writeAccessToken:"efdc4b85d66045f293a7f9e99c732f61", - readAccessToken:"595cbf76b05b45f2b3ef661a2e0078d4", + writeAccessToken:RollbarUnitTestSettings.deploysWriteAccessToken, + readAccessToken:RollbarUnitTestSettings.deploysReadAccessToken, deploymentRegistrationObserver:observer, deploymentDetailsObserver:observer, deploymentDetailsPageObserver:observer - ) + ); - deploysManager.register(deployment!) + deploysManager.register(deployment!); } @@ -72,32 +73,32 @@ final class RollbarDeploysTests: XCTestCase { let testDeploymentId = "23922850"; - let observer = RollbarDeploysObserver() + let observer = RollbarDeploysObserver(); let deploysManager = RollbarDeploysManager( - writeAccessToken:"efdc4b85d66045f293a7f9e99c732f61", - readAccessToken:"595cbf76b05b45f2b3ef661a2e0078d4", + writeAccessToken:RollbarUnitTestSettings.deploysWriteAccessToken, + readAccessToken:RollbarUnitTestSettings.deploysReadAccessToken, deploymentRegistrationObserver:observer, deploymentDetailsObserver:observer, deploymentDetailsPageObserver:observer - ) + ); - deploysManager.getDeploymentWithDeployId(testDeploymentId) + deploysManager.getDeploymentWithDeployId(testDeploymentId); } func testGetDeploymentsPage() { - let observer = RollbarDeploysObserver() + let observer = RollbarDeploysObserver(); let deploysManager = RollbarDeploysManager( - writeAccessToken:"efdc4b85d66045f293a7f9e99c732f61", - readAccessToken:"595cbf76b05b45f2b3ef661a2e0078d4", + writeAccessToken:RollbarUnitTestSettings.deploysWriteAccessToken, + readAccessToken:RollbarUnitTestSettings.deploysReadAccessToken, deploymentRegistrationObserver:observer, deploymentDetailsObserver:observer, deploymentDetailsPageObserver:observer - ) + ); - deploysManager.getDeploymentsPageNumber(1) + deploysManager.getDeploymentsPageNumber(1); } func testExample() { diff --git a/RollbarKSCrash/Package.swift b/RollbarKSCrash/Package.swift index 330aa106..5dd14e83 100644 --- a/RollbarKSCrash/Package.swift +++ b/RollbarKSCrash/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.3 +// swift-tools-version:5.5 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -24,6 +24,9 @@ let package = Package( .package(name:"RollbarCommon", path: "../RollbarCommon" ), + .package(name: "UnitTesting", + path: "../UnitTesting" + ), .package(name:"KSCrash", url: "https://github.com/kstenerud/KSCrash.git", from: "1.15.25" //Package.Dependency.Requirement.branch("master") @@ -47,14 +50,9 @@ let package = Package( ), .testTarget( name: "RollbarKSCrashTests", - dependencies: ["RollbarKSCrash"], - cSettings: [ - .headerSearchPath("Tests/RollbarKSCrashTests/**"), - // .headerSearchPath("Sources/RollbarKSCrash"), - // .headerSearchPath("Sources/RollbarKSCrash/include"), - // .headerSearchPath("Sources/RollbarKSCrash/DTOs"), - - // .define("DEFINES_MODULE"), + dependencies: [ + "UnitTesting", + "RollbarKSCrash", ] ), .testTarget( diff --git a/RollbarNotifier/Package.swift b/RollbarNotifier/Package.swift index 10625b10..a6e627bc 100644 --- a/RollbarNotifier/Package.swift +++ b/RollbarNotifier/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.2 +// swift-tools-version:5.5 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -22,6 +22,7 @@ let package = Package( // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), .package(path: "../RollbarCommon"), + .package(path: "../UnitTesting"), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. @@ -41,14 +42,9 @@ let package = Package( ), .testTarget( name: "RollbarNotifierTests", - dependencies: ["RollbarNotifier"], - cSettings: [ - .headerSearchPath("Tests/RollbarNotifierTests/**"), -// .headerSearchPath("Sources/RollbarNotifier"), -// .headerSearchPath("Sources/RollbarNotifier/include"), -// .headerSearchPath("Sources/RollbarNotifier/DTOs"), - -// .define("DEFINES_MODULE"), + dependencies: [ + "UnitTesting", + "RollbarNotifier" ] ), .testTarget( diff --git a/RollbarNotifier/Tests/RollbarNotifierTests-ObjC/PayloadTruncationTests.m b/RollbarNotifier/Tests/RollbarNotifierTests-ObjC/PayloadTruncationTests.m index a7f53f15..b518a05e 100644 --- a/RollbarNotifier/Tests/RollbarNotifierTests-ObjC/PayloadTruncationTests.m +++ b/RollbarNotifier/Tests/RollbarNotifierTests-ObjC/PayloadTruncationTests.m @@ -4,6 +4,7 @@ #if !TARGET_OS_WATCH #import +#import "../../../UnitTests/RollbarUnitTestSettings.h" #import "RollbarTestUtil.h" //#import "../Rollbar/Notifier/RollbarPayloadTruncator.h" @@ -19,8 +20,8 @@ - (void)setUp { [super setUp]; RollbarClearLogFile(); if (!Rollbar.currentConfiguration) { - [Rollbar initWithAccessToken:@"09da180aba21479e9ed3d91e0b8d58d6"]; - Rollbar.currentConfiguration.destination.environment = @"Rollbar-Apple-UnitTests"; + [Rollbar initWithAccessToken:ROLLBAR_UNIT_TEST_PAYLOADS_ACCESS_TOKEN]; + Rollbar.currentConfiguration.destination.environment = ROLLBAR_UNIT_TEST_ENVIRONMENT; } } diff --git a/RollbarNotifier/Tests/RollbarNotifierTests-ObjC/RollbarConfigurationTests.m b/RollbarNotifier/Tests/RollbarNotifierTests-ObjC/RollbarConfigurationTests.m index a29bd154..1a9d3923 100644 --- a/RollbarNotifier/Tests/RollbarNotifierTests-ObjC/RollbarConfigurationTests.m +++ b/RollbarNotifier/Tests/RollbarNotifierTests-ObjC/RollbarConfigurationTests.m @@ -4,6 +4,7 @@ #if !TARGET_OS_WATCH #import +#import "../../../UnitTests/RollbarUnitTestSettings.h" #import "RollbarTestUtil.h" @import RollbarNotifier; @@ -351,7 +352,7 @@ - (void)testScrubField { - (void)testLogTelemetryAutoCapture { NSString *logMsg = @"log-message-testing"; [[RollbarTelemetry sharedInstance] clearAllData]; - //Rollbar.currentConfiguration.accessToken = @"efdc4b85d66045f293a7f9e99c732f61"; + //Rollbar.currentConfiguration.accessToken = ROLLBAR_UNIT_TEST_DEPLOYS_WRITE_ACCESS_TOKEN; Rollbar.currentConfiguration.telemetry.enabled = YES; Rollbar.currentConfiguration.telemetry.captureLog = YES; [Rollbar reapplyConfiguration]; diff --git a/RollbarNotifier/Tests/RollbarNotifierTests-ObjC/RollbarTelemetryTests.m b/RollbarNotifier/Tests/RollbarNotifierTests-ObjC/RollbarTelemetryTests.m index 6358c814..546a71bf 100644 --- a/RollbarNotifier/Tests/RollbarNotifierTests-ObjC/RollbarTelemetryTests.m +++ b/RollbarNotifier/Tests/RollbarNotifierTests-ObjC/RollbarTelemetryTests.m @@ -4,6 +4,7 @@ #if !TARGET_OS_WATCH #import +#import "../../../UnitTests/RollbarUnitTestSettings.h" #import "RollbarTestUtil.h" @import RollbarNotifier; @@ -18,8 +19,8 @@ - (void)setUp { [super setUp]; RollbarClearLogFile(); if (!Rollbar.currentConfiguration) { - [Rollbar initWithAccessToken:@"09da180aba21479e9ed3d91e0b8d58d6"]; - Rollbar.currentConfiguration.destination.environment = @"Rollbar-Apple-UnitTests"; + [Rollbar initWithAccessToken:ROLLBAR_UNIT_TEST_PAYLOADS_ACCESS_TOKEN]; + Rollbar.currentConfiguration.destination.environment = ROLLBAR_UNIT_TEST_ENVIRONMENT; } } diff --git a/RollbarNotifier/Tests/RollbarNotifierTests-ObjC/RollbarTests.m b/RollbarNotifier/Tests/RollbarNotifierTests-ObjC/RollbarTests.m index 7ebf0b62..2df0acf2 100644 --- a/RollbarNotifier/Tests/RollbarNotifierTests-ObjC/RollbarTests.m +++ b/RollbarNotifier/Tests/RollbarNotifierTests-ObjC/RollbarTests.m @@ -4,6 +4,7 @@ #if !TARGET_OS_WATCH #import +#import "../../../UnitTests/RollbarUnitTestSettings.h" #import "RollbarTestUtil.h" @import RollbarNotifier; @@ -23,8 +24,8 @@ - (void)setUp { if (!Rollbar.currentConfiguration) { RollbarConfig *config = [[RollbarConfig alloc] init]; - config.destination.accessToken = @"09da180aba21479e9ed3d91e0b8d58d6"; - config.destination.environment = @"Rollbar-Apple-UnitTests"; + config.destination.accessToken = ROLLBAR_UNIT_TEST_PAYLOADS_ACCESS_TOKEN; + config.destination.environment = ROLLBAR_UNIT_TEST_ENVIRONMENT; config.developerOptions.transmit = YES; config.developerOptions.logPayload = YES; config.loggingOptions.maximumReportsPerMinute = 5000; @@ -46,7 +47,7 @@ - (void)testMultithreadedStressCase { for( int i = 0; i < 20; i++) { dispatch_async(dispatch_get_global_queue(QOS_CLASS_UTILITY,0), ^(){ RollbarLogger *logger = [[RollbarLogger alloc] initWithAccessToken:Rollbar.currentConfiguration.destination.accessToken]; - logger.configuration.destination.environment = @"Rollbar-Apple-UnitTests"; + logger.configuration.destination.environment = ROLLBAR_UNIT_TEST_ENVIRONMENT; for (int j = 0; j < 20; j++) { [logger log:RollbarLevel_Error message:@"error" @@ -106,7 +107,7 @@ - (void)testRollbarNotifiersIndependentConfiguration { - (void)testRollbarTransmit { Rollbar.currentConfiguration.destination.accessToken = @"09da180aba21479e9ed3d91e0b8d58d6"; - Rollbar.currentConfiguration.destination.environment = @"Rollbar-Apple-UnitTests"; + Rollbar.currentConfiguration.destination.environment = ROLLBAR_UNIT_TEST_ENVIRONMENT; Rollbar.currentConfiguration.developerOptions.transmit = YES; Rollbar.currentConfiguration.developerOptions.transmit = YES; diff --git a/RollbarNotifier/Tests/RollbarNotifierTests/RollbarNotifierConfigurationTests.swift b/RollbarNotifier/Tests/RollbarNotifierTests/RollbarNotifierConfigurationTests.swift index 4809147e..23f2c9ce 100644 --- a/RollbarNotifier/Tests/RollbarNotifierTests/RollbarNotifierConfigurationTests.swift +++ b/RollbarNotifier/Tests/RollbarNotifierTests/RollbarNotifierConfigurationTests.swift @@ -406,7 +406,7 @@ final class RollbarNotifierConfigurationTests: XCTestCase { // // let logMsg = "log-message-testing"; // RollbarTelemetry.sharedInstance().clearAllData(); -// //Rollbar.currentConfiguration.accessToken = @"efdc4b85d66045f293a7f9e99c732f61"; +// //Rollbar.currentConfiguration.accessToken = RollbarUnitTestSettings.deploysWriteAccessToken; // Rollbar.currentConfiguration().telemetryEnabled = true; // Rollbar.currentConfiguration().captureLogAsTelemetryEvents = true; // // The following line ensures the captureLogAsTelemetryData setting is flushed through the internal queue diff --git a/RollbarNotifier/Tests/RollbarNotifierTests/RollbarNotifierLoggerTests.swift b/RollbarNotifier/Tests/RollbarNotifierTests/RollbarNotifierLoggerTests.swift index 42ca2a17..20beb747 100644 --- a/RollbarNotifier/Tests/RollbarNotifierTests/RollbarNotifierLoggerTests.swift +++ b/RollbarNotifier/Tests/RollbarNotifierTests/RollbarNotifierLoggerTests.swift @@ -1,6 +1,7 @@ #if !os(watchOS) import XCTest import Foundation +import UnitTesting import os.log @testable import RollbarNotifier @@ -16,9 +17,9 @@ final class RollbarNotifierLoggerTests: XCTestCase { //if Rollbar.currentConfiguration() != nil { - Rollbar.initWithAccessToken("09da180aba21479e9ed3d91e0b8d58d6"); - Rollbar.currentConfiguration()?.destination.accessToken = "09da180aba21479e9ed3d91e0b8d58d6"; - Rollbar.currentConfiguration()?.destination.environment = "Rollbar-Apple-UnitTests"; + Rollbar.initWithAccessToken(RollbarUnitTestSettings.payloadsPostAccessToken); + Rollbar.currentConfiguration()?.destination.accessToken = RollbarUnitTestSettings.payloadsPostAccessToken; + Rollbar.currentConfiguration()?.destination.environment = RollbarUnitTestSettings.environment; Rollbar.currentConfiguration()?.developerOptions.transmit = true; Rollbar.currentConfiguration()?.developerOptions.logPayload = true; Rollbar.currentConfiguration()?.loggingOptions.maximumReportsPerMinute = 5000; @@ -86,8 +87,8 @@ final class RollbarNotifierLoggerTests: XCTestCase { //RollbarTestUtil.clearLogFile(); //RollbarTestUtil.clearTelemetryFile(); - Rollbar.currentConfiguration()?.destination.accessToken = "efdc4b85d66045f293a7f9e99c732f61"; - Rollbar.currentConfiguration()?.destination.environment = "Rollbar-Apple-UnitTests"; + Rollbar.currentConfiguration()?.destination.accessToken = RollbarUnitTestSettings.deploysWriteAccessToken; + Rollbar.currentConfiguration()?.destination.environment = RollbarUnitTestSettings.environment; Rollbar.currentConfiguration()?.developerOptions.transmit = true; Rollbar.currentConfiguration()?.developerOptions.transmit = true; diff --git a/RollbarNotifier/Tests/RollbarNotifierTests/RollbarNotifierTelemetryTests.swift b/RollbarNotifier/Tests/RollbarNotifierTests/RollbarNotifierTelemetryTests.swift index 4363760a..806a4b59 100644 --- a/RollbarNotifier/Tests/RollbarNotifierTests/RollbarNotifierTelemetryTests.swift +++ b/RollbarNotifier/Tests/RollbarNotifierTests/RollbarNotifierTelemetryTests.swift @@ -1,6 +1,7 @@ #if !os(watchOS) import XCTest import Foundation +import UnitTesting //import os.log @testable import RollbarNotifier @@ -14,8 +15,8 @@ final class RollbarNotifierTelemetryTests: XCTestCase { print("Info: Rollbar already pre-configured!"); } else { - Rollbar.initWithAccessToken("09da180aba21479e9ed3d91e0b8d58d6"); - Rollbar.currentConfiguration()?.destination.environment = "Rollbar-Apple-UnitTests"; + Rollbar.initWithAccessToken(RollbarUnitTestSettings.payloadsPostAccessToken); + Rollbar.currentConfiguration()?.destination.environment = RollbarUnitTestSettings.environment; } } diff --git a/RollbarNotifier/Tests/RollbarNotifierTests/RollbarNotifierTruncationTests.swift b/RollbarNotifier/Tests/RollbarNotifierTests/RollbarNotifierTruncationTests.swift index a6eafb61..ab409746 100644 --- a/RollbarNotifier/Tests/RollbarNotifierTests/RollbarNotifierTruncationTests.swift +++ b/RollbarNotifier/Tests/RollbarNotifierTests/RollbarNotifierTruncationTests.swift @@ -1,6 +1,7 @@ #if !os(watchOS) import XCTest import Foundation +import UnitTesting import os.log @testable import RollbarNotifier @@ -14,8 +15,8 @@ final class RollbarNotifierTruncationTests: XCTestCase { RollbarTestUtil.clearTelemetryFile(); //if Rollbar.currentConfiguration() != nil { - Rollbar.initWithAccessToken("09da180aba21479e9ed3d91e0b8d58d6"); - Rollbar.currentConfiguration()?.destination.environment = "Rollbar-Apple-UnitTests"; + Rollbar.initWithAccessToken(RollbarUnitTestSettings.payloadsPostAccessToken); + Rollbar.currentConfiguration()?.destination.environment = RollbarUnitTestSettings.environment; //} } diff --git a/RollbarPLCrashReporter/Package.swift b/RollbarPLCrashReporter/Package.swift index 26ece360..d5891ced 100644 --- a/RollbarPLCrashReporter/Package.swift +++ b/RollbarPLCrashReporter/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.3 +// swift-tools-version:5.5 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -24,6 +24,9 @@ let package = Package( .package(name:"RollbarCommon", path: "../RollbarCommon" ), + .package(name: "UnitTesting", + path: "../UnitTesting" + ), .package(name:"PLCrashReporter", url: "https://github.com/microsoft/plcrashreporter.git", from: "1.10.0" //Package.Dependency.Requirement.branch("master") @@ -47,14 +50,9 @@ let package = Package( ), .testTarget( name: "RollbarPLCrashReporterTests", - dependencies: ["RollbarPLCrashReporter"], - cSettings: [ - .headerSearchPath("Tests/RollbarKSCrashTests/**"), - // .headerSearchPath("Sources/RollbarKSCrash"), - // .headerSearchPath("Sources/RollbarKSCrash/include"), - // .headerSearchPath("Sources/RollbarKSCrash/DTOs"), - - // .define("DEFINES_MODULE"), + dependencies: [ + "UnitTesting", + "RollbarPLCrashReporter", ] ), .testTarget( diff --git a/RollbarSDK.xcworkspace/contents.xcworkspacedata b/RollbarSDK.xcworkspace/contents.xcworkspacedata index 0c3fe25f..c834da3e 100644 --- a/RollbarSDK.xcworkspace/contents.xcworkspacedata +++ b/RollbarSDK.xcworkspace/contents.xcworkspacedata @@ -4,6 +4,13 @@ + + + + @@ -74,6 +81,9 @@ + + diff --git a/RollbarSwift/Package.swift b/RollbarSwift/Package.swift index 9024ce69..cc32cb7b 100644 --- a/RollbarSwift/Package.swift +++ b/RollbarSwift/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.3 +// swift-tools-version:5.5 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -23,6 +23,9 @@ let package = Package( // .package(url: /* package url */, from: "1.0.0"), .package(path: "../RollbarCommon"), .package(path: "../RollbarNotifier"), + .package(name: "UnitTesting", + path: "../UnitTesting" + ), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. @@ -42,14 +45,9 @@ let package = Package( ), .testTarget( name: "RollbarSwiftTests", - dependencies: ["RollbarSwift"], - cSettings: [ - .headerSearchPath("Tests/RollbarSwiftTests/**"), -// .headerSearchPath("Sources/RollbarNotifier"), -// .headerSearchPath("Sources/RollbarNotifier/include"), -// .headerSearchPath("Sources/RollbarNotifier/DTOs"), - -// .define("DEFINES_MODULE"), + dependencies: [ + "UnitTesting", + "RollbarSwift", ] ), .testTarget( diff --git a/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift b/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift index e41b2202..cbbc54c2 100644 --- a/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift +++ b/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift @@ -1,4 +1,5 @@ import XCTest +import UnitTesting import RollbarNotifier @testable import RollbarSwift @@ -17,8 +18,8 @@ final class RollbarSwiftTests: XCTestCase { func createGuard() -> RollbarExceptionGuard { let config = RollbarConfig(); - config.destination.accessToken = "09da180aba21479e9ed3d91e0b8d58d6"; - config.destination.environment = "Rollbar-Apple-UnitTests"; + config.destination.accessToken = RollbarUnitTestSettings.payloadsPostAccessToken; + config.destination.environment = RollbarUnitTestSettings.environment; config.developerOptions.transmit = true; let logger = RollbarLogger(configuration: config); diff --git a/UnitTesting/.gitignore b/UnitTesting/.gitignore new file mode 100644 index 00000000..bb460e7b --- /dev/null +++ b/UnitTesting/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +/.build +/Packages +/*.xcodeproj +xcuserdata/ +DerivedData/ +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata diff --git a/UnitTesting/Package.swift b/UnitTesting/Package.swift new file mode 100644 index 00000000..e0f59532 --- /dev/null +++ b/UnitTesting/Package.swift @@ -0,0 +1,28 @@ +// swift-tools-version:5.5 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "UnitTesting", + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "UnitTesting", + targets: ["UnitTesting"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "UnitTesting", + dependencies: []), + .testTarget( + name: "UnitTestingTests", + dependencies: ["UnitTesting"]), + ] +) diff --git a/UnitTesting/README.md b/UnitTesting/README.md new file mode 100644 index 00000000..6959452c --- /dev/null +++ b/UnitTesting/README.md @@ -0,0 +1,3 @@ +# UnitTesting + +A description of this package. diff --git a/UnitTesting/Sources/UnitTesting/RollbarUnitTestSettings.swift b/UnitTesting/Sources/UnitTesting/RollbarUnitTestSettings.swift new file mode 100644 index 00000000..d89c71f1 --- /dev/null +++ b/UnitTesting/Sources/UnitTesting/RollbarUnitTestSettings.swift @@ -0,0 +1,8 @@ +import Foundation + +public struct RollbarUnitTestSettings { + public static let environment = "Rollbar-Apple-UnitTests"; + public static let payloadsPostAccessToken = "09da180aba21479e9ed3d91e0b8d58d6"; + public static let deploysWriteAccessToken = "efdc4b85d66045f293a7f9e99c732f61"; + public static let deploysReadAccessToken = "595cbf76b05b45f2b3ef661a2e0078d4"; +} diff --git a/UnitTesting/Tests/UnitTestingTests/UnitTestingTests.swift b/UnitTesting/Tests/UnitTestingTests/UnitTestingTests.swift new file mode 100644 index 00000000..1532e3c0 --- /dev/null +++ b/UnitTesting/Tests/UnitTestingTests/UnitTestingTests.swift @@ -0,0 +1,11 @@ +import XCTest +@testable import UnitTesting + +final class UnitTestingTests: XCTestCase { +// func testExample() throws { +// // This is an example of a functional test case. +// // Use XCTAssert and related functions to verify your tests produce the correct +// // results. +// XCTAssertEqual(UnitTesting().text, "Hello, World!") +// } +} diff --git a/UnitTests/RollbarUnitTestSettings.h b/UnitTests/RollbarUnitTestSettings.h new file mode 100644 index 00000000..69213114 --- /dev/null +++ b/UnitTests/RollbarUnitTestSettings.h @@ -0,0 +1,16 @@ +#ifndef RollbarUnitTestSettings_h +#define RollbarUnitTestSettings_h + +static NSString * const ROLLBAR_UNIT_TEST_ENVIRONMENT = +@"Rollbar-Apple-UnitTests"; + +static NSString * const ROLLBAR_UNIT_TEST_PAYLOADS_ACCESS_TOKEN = +@"09da180aba21479e9ed3d91e0b8d58d6"; + +static NSString * const ROLLBAR_UNIT_TEST_DEPLOYS_WRITE_ACCESS_TOKEN = +@"efdc4b85d66045f293a7f9e99c732f61"; + +static NSString * const ROLLBAR_UNIT_TEST_DEPLOYS_READ_ACCESS_TOKEN = +@"595cbf76b05b45f2b3ef661a2e0078d4"; + +#endif /* RollbarUnitTestSettings_h */ From 1b9d9d5e947e72ff59c4e02570566571b28090d2 Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Wed, 23 Feb 2022 01:01:03 -0800 Subject: [PATCH 4/4] chore: updater SPM manifest --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index e93def46..6feec7ba 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.2 +// swift-tools-version:5.5 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription