From 456a6da1882909cdc54f476bb3752d69145f6610 Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Wed, 22 Jul 2020 15:46:28 +0300 Subject: [PATCH 01/34] Fix callback threading on MacCatalyst --- Sasquatch/Sasquatch/MSAAnalyticsAuthenticationProvider.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sasquatch/Sasquatch/MSAAnalyticsAuthenticationProvider.swift b/Sasquatch/Sasquatch/MSAAnalyticsAuthenticationProvider.swift index 623a46b9de..c12d2dc65e 100644 --- a/Sasquatch/Sasquatch/MSAAnalyticsAuthenticationProvider.swift +++ b/Sasquatch/Sasquatch/MSAAnalyticsAuthenticationProvider.swift @@ -86,6 +86,8 @@ class MSAAnalyticsAuthenticationProvider: NSObject, MSAnalyticsAuthenticationPro } func close() { + DispatchQueue.main.async { self.viewController?.dismiss(animated: true, completion: nil) + } } } From c000262bfd88adc24df2331061e24863340cd29a Mon Sep 17 00:00:00 2001 From: Connor Qi Date: Thu, 23 Jul 2020 19:54:24 +0800 Subject: [PATCH 02/34] Bump version after release to 3.3.3 --- AppCenter.podspec | 2 +- CHANGELOG.md | 4 ++++ Config/Version.xcconfig | 2 +- Documentation/iOS/AppCenter/.jazzy.yaml | 2 +- Documentation/iOS/AppCenterAnalytics/.jazzy.yaml | 2 +- Documentation/iOS/AppCenterCrashes/.jazzy.yaml | 2 +- Documentation/iOS/AppCenterDistribute/.jazzy.yaml | 2 +- Documentation/iOS/AppCenterPush/.jazzy.yaml | 2 +- Documentation/macOS/AppCenter/.jazzy.yaml | 2 +- Documentation/macOS/AppCenterAnalytics/.jazzy.yaml | 2 +- Documentation/macOS/AppCenterCrashes/.jazzy.yaml | 2 +- Documentation/macOS/AppCenterPush/.jazzy.yaml | 2 +- Documentation/tvOS/AppCenter/.jazzy.yaml | 2 +- Documentation/tvOS/AppCenterAnalytics/.jazzy.yaml | 2 +- Documentation/tvOS/AppCenterCrashes/.jazzy.yaml | 2 +- Package.swift | 2 +- 16 files changed, 19 insertions(+), 15 deletions(-) diff --git a/AppCenter.podspec b/AppCenter.podspec index a6dd359a3c..b4c4d91e52 100644 --- a/AppCenter.podspec +++ b/AppCenter.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'AppCenter' - s.version = '3.3.2' + s.version = '3.3.3' s.summary = 'Visual Studio App Center is your continuous integration, delivery and learning solution for iOS and macOS apps.' s.description = <<-DESC diff --git a/CHANGELOG.md b/CHANGELOG.md index 765cc6be59..5b8972b828 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # App Center SDK for iOS, macOS and tvOS Change Log +## Version 3.3.3 (Under development) + +___ + ## Version 3.3.2 ### App Center Distribute diff --git a/Config/Version.xcconfig b/Config/Version.xcconfig index 2def9aec9c..2e9b813176 100644 --- a/Config/Version.xcconfig +++ b/Config/Version.xcconfig @@ -1,2 +1,2 @@ BUILD_NUMBER = 1 -VERSION_STRING = 3.3.2 +VERSION_STRING = 3.3.3 diff --git a/Documentation/iOS/AppCenter/.jazzy.yaml b/Documentation/iOS/AppCenter/.jazzy.yaml index 68e640b6e0..bb78e5ca0a 100644 --- a/Documentation/iOS/AppCenter/.jazzy.yaml +++ b/Documentation/iOS/AppCenter/.jazzy.yaml @@ -5,7 +5,7 @@ sdk: iphonesimulator theme: ../../Themes/apple module: AppCenter -module_version: 3.3.2 +module_version: 3.3.3 author: Microsoft Corp author_url: http://www.microsoft.com diff --git a/Documentation/iOS/AppCenterAnalytics/.jazzy.yaml b/Documentation/iOS/AppCenterAnalytics/.jazzy.yaml index 0e269e0193..68ada8c329 100644 --- a/Documentation/iOS/AppCenterAnalytics/.jazzy.yaml +++ b/Documentation/iOS/AppCenterAnalytics/.jazzy.yaml @@ -5,7 +5,7 @@ sdk: iphonesimulator theme: ../../Themes/apple module: AppCenterAnalytics -module_version: 3.3.2 +module_version: 3.3.3 author: Microsoft Corp author_url: http://www.microsoft.com diff --git a/Documentation/iOS/AppCenterCrashes/.jazzy.yaml b/Documentation/iOS/AppCenterCrashes/.jazzy.yaml index 86775c4f8d..fa542bff5c 100644 --- a/Documentation/iOS/AppCenterCrashes/.jazzy.yaml +++ b/Documentation/iOS/AppCenterCrashes/.jazzy.yaml @@ -5,7 +5,7 @@ sdk: iphonesimulator theme: ../../Themes/apple module: AppCenterCrashes -module_version: 3.3.2 +module_version: 3.3.3 author: Microsoft Corp author_url: http://www.microsoft.com diff --git a/Documentation/iOS/AppCenterDistribute/.jazzy.yaml b/Documentation/iOS/AppCenterDistribute/.jazzy.yaml index 5300ced813..50ae67a664 100644 --- a/Documentation/iOS/AppCenterDistribute/.jazzy.yaml +++ b/Documentation/iOS/AppCenterDistribute/.jazzy.yaml @@ -5,7 +5,7 @@ sdk: iphonesimulator theme: ../../Themes/apple module: AppCenterDistribute -module_version: 3.3.2 +module_version: 3.3.3 author: Microsoft Corp author_url: http://www.microsoft.com diff --git a/Documentation/iOS/AppCenterPush/.jazzy.yaml b/Documentation/iOS/AppCenterPush/.jazzy.yaml index 41b3746c63..b91cd457d8 100644 --- a/Documentation/iOS/AppCenterPush/.jazzy.yaml +++ b/Documentation/iOS/AppCenterPush/.jazzy.yaml @@ -5,7 +5,7 @@ sdk: iphonesimulator theme: ../../Themes/apple module: AppCenterPush -module_version: 3.3.2 +module_version: 3.3.3 author: Microsoft Corp author_url: http://www.microsoft.com diff --git a/Documentation/macOS/AppCenter/.jazzy.yaml b/Documentation/macOS/AppCenter/.jazzy.yaml index d65ee21134..6d625c593b 100644 --- a/Documentation/macOS/AppCenter/.jazzy.yaml +++ b/Documentation/macOS/AppCenter/.jazzy.yaml @@ -5,7 +5,7 @@ sdk: macosx theme: ../../Themes/apple module: AppCenter -module_version: 3.3.2 +module_version: 3.3.3 author: Microsoft Corp author_url: http://www.microsoft.com diff --git a/Documentation/macOS/AppCenterAnalytics/.jazzy.yaml b/Documentation/macOS/AppCenterAnalytics/.jazzy.yaml index ec4fd194c1..48b8a5b274 100644 --- a/Documentation/macOS/AppCenterAnalytics/.jazzy.yaml +++ b/Documentation/macOS/AppCenterAnalytics/.jazzy.yaml @@ -5,7 +5,7 @@ sdk: macosx theme: ../../Themes/apple module: AppCenterAnalytics -module_version: 3.3.2 +module_version: 3.3.3 author: Microsoft Corp author_url: http://www.microsoft.com diff --git a/Documentation/macOS/AppCenterCrashes/.jazzy.yaml b/Documentation/macOS/AppCenterCrashes/.jazzy.yaml index 1b60ab14a9..f9e3b81473 100644 --- a/Documentation/macOS/AppCenterCrashes/.jazzy.yaml +++ b/Documentation/macOS/AppCenterCrashes/.jazzy.yaml @@ -5,7 +5,7 @@ sdk: macosx theme: ../../Themes/apple module: AppCenterCrashes -module_version: 3.3.2 +module_version: 3.3.3 author: Microsoft Corp author_url: http://www.microsoft.com diff --git a/Documentation/macOS/AppCenterPush/.jazzy.yaml b/Documentation/macOS/AppCenterPush/.jazzy.yaml index cfa1ae89cf..d5a62e718a 100644 --- a/Documentation/macOS/AppCenterPush/.jazzy.yaml +++ b/Documentation/macOS/AppCenterPush/.jazzy.yaml @@ -5,7 +5,7 @@ sdk: macosx theme: ../../Themes/apple module: AppCenterPush -module_version: 3.3.2 +module_version: 3.3.3 author: Microsoft Corp author_url: http://www.microsoft.com diff --git a/Documentation/tvOS/AppCenter/.jazzy.yaml b/Documentation/tvOS/AppCenter/.jazzy.yaml index cb60838741..681c408a5d 100644 --- a/Documentation/tvOS/AppCenter/.jazzy.yaml +++ b/Documentation/tvOS/AppCenter/.jazzy.yaml @@ -5,7 +5,7 @@ sdk: appletvsimulator theme: ../../Themes/apple module: AppCenter -module_version: 3.3.2 +module_version: 3.3.3 author: Microsoft Corp author_url: http://www.microsoft.com diff --git a/Documentation/tvOS/AppCenterAnalytics/.jazzy.yaml b/Documentation/tvOS/AppCenterAnalytics/.jazzy.yaml index 1327a6f691..b5b419f13e 100644 --- a/Documentation/tvOS/AppCenterAnalytics/.jazzy.yaml +++ b/Documentation/tvOS/AppCenterAnalytics/.jazzy.yaml @@ -5,7 +5,7 @@ sdk: appletvsimulator theme: ../../Themes/apple module: AppCenterAnalytics -module_version: 3.3.2 +module_version: 3.3.3 author: Microsoft Corp author_url: http://www.microsoft.com diff --git a/Documentation/tvOS/AppCenterCrashes/.jazzy.yaml b/Documentation/tvOS/AppCenterCrashes/.jazzy.yaml index 59ae78f408..f888240211 100644 --- a/Documentation/tvOS/AppCenterCrashes/.jazzy.yaml +++ b/Documentation/tvOS/AppCenterCrashes/.jazzy.yaml @@ -5,7 +5,7 @@ sdk: appletvsimulator theme: ../../Themes/apple module: AppCenterCrashes -module_version: 3.3.2 +module_version: 3.3.3 author: Microsoft Corp author_url: http://www.microsoft.com diff --git a/Package.swift b/Package.swift index d4dedc081d..3f9a096c64 100644 --- a/Package.swift +++ b/Package.swift @@ -31,7 +31,7 @@ let package = Package( path: "AppCenter/AppCenter", exclude: ["Support"], cSettings: [ - .define("APP_CENTER_C_VERSION", to:"\"3.3.2\""), + .define("APP_CENTER_C_VERSION", to:"\"3.3.3\""), .define("APP_CENTER_C_BUILD", to:"\"1\""), .headerSearchPath("**"), ], From 9920e4f2149d68d994769e5556e676d86722385c Mon Sep 17 00:00:00 2001 From: Petr2020 Date: Sat, 25 Jul 2020 19:27:01 +0800 Subject: [PATCH 03/34] Update MSCrashesDelegate.h I guess this comment seems to be a typo --- AppCenterCrashes/AppCenterCrashes/MSCrashesDelegate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppCenterCrashes/AppCenterCrashes/MSCrashesDelegate.h b/AppCenterCrashes/AppCenterCrashes/MSCrashesDelegate.h index ecc249f041..15089913f0 100644 --- a/AppCenterCrashes/AppCenterCrashes/MSCrashesDelegate.h +++ b/AppCenterCrashes/AppCenterCrashes/MSCrashesDelegate.h @@ -32,7 +32,7 @@ - (void)crashes:(MSCrashes *)crashes willSendErrorReport:(MSErrorReport *)errorReport; /** - * Callback method that will be called in case the SDK was unable to send an error report to the server. + * Callback method that will be called after the SDK successfully sent an error report to the server. * * @param crashes The instance of MSCrashes. * @param errorReport The errorReport that App Center sent. From 30617db46e7ed5cdad40742335da8f6aac5972c0 Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Tue, 28 Jul 2020 14:19:37 +0300 Subject: [PATCH 04/34] Fix integer casting --- .../AppCenter/Internals/Vendor/Reachability/MS_Reachability.m | 2 +- AppCenter/AppCenter/MSAppCenter.m | 2 +- Vendor/PLCrashReporter | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/AppCenter/AppCenter/Internals/Vendor/Reachability/MS_Reachability.m b/AppCenter/AppCenter/Internals/Vendor/Reachability/MS_Reachability.m index 3fa4225502..15cf6305a2 100644 --- a/AppCenter/AppCenter/Internals/Vendor/Reachability/MS_Reachability.m +++ b/AppCenter/AppCenter/Internals/Vendor/Reachability/MS_Reachability.m @@ -213,7 +213,7 @@ - (BOOL)connectionRequired { SCNetworkReachabilityFlags flags; if (SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags)) { - return (flags & kSCNetworkReachabilityFlagsConnectionRequired); + return (flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0; } return NO; diff --git a/AppCenter/AppCenter/MSAppCenter.m b/AppCenter/AppCenter/MSAppCenter.m index 5021b784e7..1482467d6b 100644 --- a/AppCenter/AppCenter/MSAppCenter.m +++ b/AppCenter/AppCenter/MSAppCenter.m @@ -302,7 +302,7 @@ - (BOOL)configureWithAppSecret:(NSString *)appSecret [self initializeChannelGroup]; [self applyPipelineEnabledState:self.isEnabled]; self.sdkConfigured = YES; - self.configuredFromApplication |= fromApplication; + self.configuredFromApplication = self.configuredFromApplication || fromApplication; /* * If the log level hasn't been customized before and we are not running in an app store environment, we set the default log level to diff --git a/Vendor/PLCrashReporter b/Vendor/PLCrashReporter index 22d0ec938e..ec31c6c301 160000 --- a/Vendor/PLCrashReporter +++ b/Vendor/PLCrashReporter @@ -1 +1 @@ -Subproject commit 22d0ec938ee3d9c9b8d761ae386516984e69c6c2 +Subproject commit ec31c6c3017854c57736bac2b0d174eecef920cb From 6f2b5ebbb906429617e0245f6304ad17c9a38425 Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Tue, 28 Jul 2020 14:20:17 +0300 Subject: [PATCH 05/34] Remove replacing default archs from configs --- Config/Global.xcconfig | 3 --- Config/macOS.xcconfig | 2 -- Config/tvOS.xcconfig | 4 ---- CrashLib/Config/CrashLib.xcconfig | 1 - SasquatchMac/Config/Sasquatch.xcconfig | 1 - 5 files changed, 11 deletions(-) diff --git a/Config/Global.xcconfig b/Config/Global.xcconfig index dbc9604a52..d4618fdff1 100644 --- a/Config/Global.xcconfig +++ b/Config/Global.xcconfig @@ -1,8 +1,5 @@ #include "./Version.xcconfig" -// :Mark: Architectures -MS_WATCH_ARCHS = armv7k arm64_32 -MS_SIM_ARCHS = x86_64 i386 SDKROOT = iphoneos // :Mark: Deployment diff --git a/Config/macOS.xcconfig b/Config/macOS.xcconfig index ead3828a0a..1bf506f05c 100644 --- a/Config/macOS.xcconfig +++ b/Config/macOS.xcconfig @@ -1,6 +1,4 @@ SDKROOT = macosx -ARCHS = x86_64 -VALID_ARCHS = $(ARCHS) i386 SKIP_INSTALL = YES APPCENTER_BUILD_PLATFORM = macOS diff --git a/Config/tvOS.xcconfig b/Config/tvOS.xcconfig index e0376ac978..1ffccc4370 100644 --- a/Config/tvOS.xcconfig +++ b/Config/tvOS.xcconfig @@ -1,8 +1,4 @@ SDKROOT = appletvos -ARCHS = arm64 -ARCHS[sdk=appletvsimulator*] = $(MS_SIM_ARCHS) -VALID_ARCHS = $(ARCHS) -VALID_ARCHS[sdk=appletvsimulator*] = $(MS_SIM_ARCHS) SKIP_INSTALL = YES TARGETED_DEVICE_FAMILY = 3 diff --git a/CrashLib/Config/CrashLib.xcconfig b/CrashLib/Config/CrashLib.xcconfig index bb8bb15c91..fe59bcc3d0 100644 --- a/CrashLib/Config/CrashLib.xcconfig +++ b/CrashLib/Config/CrashLib.xcconfig @@ -1,7 +1,6 @@ #include "../../Config/App.xcconfig" PRODUCT_NAME = $(TARGET_NAME) -MS_SIM_ARCHS = x86_64 i386 DYLIB_COMPATIBILITY_VERSION = 1 DYLIB_CURRENT_VERSION = 1 diff --git a/SasquatchMac/Config/Sasquatch.xcconfig b/SasquatchMac/Config/Sasquatch.xcconfig index 85e522bdab..a491947402 100644 --- a/SasquatchMac/Config/Sasquatch.xcconfig +++ b/SasquatchMac/Config/Sasquatch.xcconfig @@ -22,7 +22,6 @@ LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../Frameworks MACOSX_DEPLOYMENT_TARGET = 10.10 SDKROOT = macosx -VALID_ARCHS = x86_64 CLANG_ANALYZER_NONNULL = YES CLANG_ENABLE_MODULES = YES From ad909f40e8861b584ece69aa55ccfcdd20bffc58 Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Wed, 29 Jul 2020 12:22:32 +0300 Subject: [PATCH 06/34] Remove arm64 from Simulator architectures for now --- Config/Global.xcconfig | 2 ++ Config/iOS.xcconfig | 2 ++ Config/tvOS.xcconfig | 2 ++ CrashLib/Config/CrashLib.xcconfig | 1 + 4 files changed, 7 insertions(+) diff --git a/Config/Global.xcconfig b/Config/Global.xcconfig index d4618fdff1..b9a4e765bf 100644 --- a/Config/Global.xcconfig +++ b/Config/Global.xcconfig @@ -1,5 +1,7 @@ #include "./Version.xcconfig" +// :Mark: Architectures +MS_SIM_ARCHS = x86_64 i386 SDKROOT = iphoneos // :Mark: Deployment diff --git a/Config/iOS.xcconfig b/Config/iOS.xcconfig index ee96de5f7f..c8e91edf47 100644 --- a/Config/iOS.xcconfig +++ b/Config/iOS.xcconfig @@ -2,6 +2,8 @@ SDKROOT = iphoneos TARGETED_DEVICE_FAMILY = 1,2 SUPPORTS_MACCATALYST = YES ARCHS[sdk=iphoneos*] = $(ARCHS_STANDARD) armv7s arm64e +ARCHS[sdk=iphonesimulator*] = $(MS_SIM_ARCHS) +VALID_ARCHS[sdk=iphonesimulator*] = $(MS_SIM_ARCHS) SKIP_INSTALL = YES OTHER_CFLAGS = $(inherited) -fembed-bitcode-marker diff --git a/Config/tvOS.xcconfig b/Config/tvOS.xcconfig index 1ffccc4370..d51b911a25 100644 --- a/Config/tvOS.xcconfig +++ b/Config/tvOS.xcconfig @@ -1,4 +1,6 @@ SDKROOT = appletvos +ARCHS[sdk=appletvsimulator*] = $(MS_SIM_ARCHS) +VALID_ARCHS[sdk=appletvsimulator*] = $(MS_SIM_ARCHS) SKIP_INSTALL = YES TARGETED_DEVICE_FAMILY = 3 diff --git a/CrashLib/Config/CrashLib.xcconfig b/CrashLib/Config/CrashLib.xcconfig index fe59bcc3d0..bb8bb15c91 100644 --- a/CrashLib/Config/CrashLib.xcconfig +++ b/CrashLib/Config/CrashLib.xcconfig @@ -1,6 +1,7 @@ #include "../../Config/App.xcconfig" PRODUCT_NAME = $(TARGET_NAME) +MS_SIM_ARCHS = x86_64 i386 DYLIB_COMPATIBILITY_VERSION = 1 DYLIB_CURRENT_VERSION = 1 From 4e2fcb7aa0d68755f587ed2590c5dc94325ec5c5 Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Wed, 29 Jul 2020 12:28:39 +0300 Subject: [PATCH 07/34] Fix extension target --- Sasquatch/Config/Sasquatch Extension.xcconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/Sasquatch/Config/Sasquatch Extension.xcconfig b/Sasquatch/Config/Sasquatch Extension.xcconfig index 8d6696dbae..93c38e1ef7 100644 --- a/Sasquatch/Config/Sasquatch Extension.xcconfig +++ b/Sasquatch/Config/Sasquatch Extension.xcconfig @@ -1,2 +1,3 @@ LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../../Frameworks ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO +IPHONEOS_DEPLOYMENT_TARGET = 10.0 From 62be6ce49931097ca7d211bb7965bcb3d65b50a4 Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Fri, 31 Jul 2020 10:55:15 +0300 Subject: [PATCH 08/34] Update cg manifest and changelog --- CHANGELOG.md | 4 ++++ Package.swift | 2 +- cgmanifest.json | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b8972b828..1ea91d3b3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Version 3.3.3 (Under development) +### App Center + +* **[Fix]** Fix compatibility with Xcode 12 beta when integrating SDK from sources. + ___ ## Version 3.3.2 diff --git a/Package.swift b/Package.swift index 3f9a096c64..4804877463 100644 --- a/Package.swift +++ b/Package.swift @@ -23,7 +23,7 @@ let package = Package( targets: ["AppCenterCrashes"]) ], dependencies: [ - .package(url: "https://github.com/microsoft/plcrashreporter.git", .upToNextMinor(from: "1.7.1")), + .package(url: "https://github.com/microsoft/plcrashreporter.git", .revision("ec31c6c3017854c57736bac2b0d174eecef920cb")), ], targets: [ .target( diff --git a/cgmanifest.json b/cgmanifest.json index 2cb7b13aab..b638b36b67 100644 --- a/cgmanifest.json +++ b/cgmanifest.json @@ -6,7 +6,7 @@ "git": { "name": "PLCrashReporter", "repositoryUrl": "https://github.com/microsoft/plcrashreporter.git", - "commitHash": "22d0ec938ee3d9c9b8d761ae386516984e69c6c2" + "commitHash": "ec31c6c3017854c57736bac2b0d174eecef920cb" } } }, From d79e4b1710631f85a3c92cb9cf63e5fa6f63bf3d Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Tue, 4 Aug 2020 10:38:45 +0300 Subject: [PATCH 09/34] Add temporary TODO --- Package.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Package.swift b/Package.swift index 4804877463..99a3c4090c 100644 --- a/Package.swift +++ b/Package.swift @@ -23,6 +23,7 @@ let package = Package( targets: ["AppCenterCrashes"]) ], dependencies: [ + // TODO replace commit hash to released version before release. .package(url: "https://github.com/microsoft/plcrashreporter.git", .revision("ec31c6c3017854c57736bac2b0d174eecef920cb")), ], targets: [ From ea811824e56442d61b2b2a83960ffad1b0ae0d91 Mon Sep 17 00:00:00 2001 From: Anastasia Kubova Date: Tue, 4 Aug 2020 10:40:43 +0300 Subject: [PATCH 10/34] Add script for sorting schemes --- Scripts/sort-schemes.sh | 119 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100755 Scripts/sort-schemes.sh diff --git a/Scripts/sort-schemes.sh b/Scripts/sort-schemes.sh new file mode 100755 index 0000000000..19ecc32fa7 --- /dev/null +++ b/Scripts/sort-schemes.sh @@ -0,0 +1,119 @@ +#!/bin/bash + +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +# Sort the order of projects' schemes. +# Usage: sort-schemes.sh + +# Alias for replacing symbols. +aliasNewLine='@' +aliasNumber='%numberAlias%' + +# Regex constans for change number. +regexStartPlaceNumber="[a-zA-z -^#.]*<\/key>[${aliasNewLine}][[:space:]]*[${aliasNewLine}][[:space:]]*orderHint<\/key>[${aliasNewLine}][[:space:]]*" +regexEndPlaceNumber="<\/integer>[${aliasNewLine}][[:space:]]*<\/dict>" + +# Regex constans for hidden schemes. +regexHiddenScheme="isShown<\/key>" +regexStartHiddenScheme="[a-zA-z -^#.]*<\/key>[${aliasNewLine}][[:space:]]*[${aliasNewLine}][[:space:]]*" +regexEndHiddenScheme="orderHint<\/key>[${aliasNewLine}][[:space:]]*[0-9]*<\/integer>[${aliasNewLine}][[:space:]]*<\/dict>" + +# Scheme counter. +currentSchemeNumber=0; + +replace_number_or_hide_scheme() { + + # Get params. + projectName=$1 + isHidden=$2 + + # Build path to file of scheme. + fileName="${projectName}/xcuserdata/$USER.xcuserdatad/xcschemes/xcschememanagement.plist" + + # Prepare the backup file. + backupFile="${fileName}.bak" + + # Set the start of regex based on isHidden value. + if $isHidden ; then + lastRegex=$regexStartHiddenScheme + else + lastRegex=$regexStartPlaceNumber + fi + isNotEnd=true + + # Check that the scheme file exists. + if [ -f "$fileName" ] ; then + while ($isNotEnd) ; do + if $isHidden ; then + + # Regex for search the place for hide the scheme. + pattern="(${lastRegex})(${regexEndHiddenScheme})" + + # Regex for hidden scheme. + replacePattern="\1$regexHiddenScheme\2" + else + + # Regex for search the number of scheme. + pattern="(${lastRegex})\d+(${regexEndPlaceNumber})" + + # Regex for replacing the number of scheme. + replacePattern="\1${aliasNumber}${currentSchemeNumber}\2" + fi + + # Replace new line to alias. + tr '\n' "${aliasNewLine}" < ${fileName} > ${backupFile} + + # Replace number of scheme. + perl -i -pe "s/${pattern}/${replacePattern}/" ${backupFile} + + # This is a fix to avoid problems with inserting number value via perl. + perl -i -pe "s/${aliasNumber}//" ${backupFile} + + # Replace new line alias to new line symbol. + tr ${aliasNewLine} '\n' < ${backupFile} > ${fileName} + + # Build regex the for next scheme place. + if $isHidden ; then + lastRegex="${lastRegex}${regexHiddenScheme}${regexEndHiddenScheme}${aliasNewLine}[[:space:]]*${regexStartHiddenScheme}" + else + lastRegex="${lastRegex}[0-9]*${regexEndPlaceNumber}${aliasNewLine}[[:space:]]*${regexStartPlaceNumber}" + fi + + # Check that the file still has matches for the given regex. + countMatches=$(cat ${backupFile} | grep -o "$lastRegex" | wc -l) + if (( $countMatches < 1 )) ; then + isNotEnd=false + fi + + # Increase schemes number + currentSchemeNumber=$((currentSchemeNumber+1)) + + # Remove backup file. + rm ${backupFile} + done + else + echo "The schemes configuration does not exist for the project ${projectName}." + fi +} + +# Sort scheme in the AppCenter.xcworkspace project. +replace_number_or_hide_scheme "AppCenter.xcworkspace" false + +# Sort schemes in modules projects. +replace_number_or_hide_scheme "AppCenter/AppCenter.xcodeproj" false +replace_number_or_hide_scheme "AppCenterAnalytics/AppCenterAnalytics.xcodeproj" false +replace_number_or_hide_scheme "AppCenterCrashes/AppCenterCrashes.xcodeproj" false +replace_number_or_hide_scheme "AppCenterDistribute/AppCenterDistribute.xcodeproj" false +replace_number_or_hide_scheme "AppCenterPush/AppCenterPush.xcodeproj" false + +# Sort schemes in apps projects. +replace_number_or_hide_scheme "Sasquatch/Sasquatch.xcodeproj" false +replace_number_or_hide_scheme "SasquatchMac/SasquatchMac.xcodeproj" false +replace_number_or_hide_scheme "SasquatchTV/SasquatchTV.xcodeproj" false + +# Sort other schemes. +replace_number_or_hide_scheme "CrashLib/CrashLib.xcodeproj" false +replace_number_or_hide_scheme "Vendor/PLCrashReporter/CrashReporter.xcodeproj" false +replace_number_or_hide_scheme "Vendor/OCMock/Source/OCMock.xcodeproj" true +replace_number_or_hide_scheme "Vendor/OCHamcrest/Source/OCHamcrest.xcodeproj" true From e2e8b4d72f6d09d577e970a72a229b9667261d91 Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Tue, 4 Aug 2020 13:53:22 +0300 Subject: [PATCH 11/34] Add archs verification --- Scripts/build-archive.sh | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/Scripts/build-archive.sh b/Scripts/build-archive.sh index f6ad6f4f7c..9a3067ba23 100755 --- a/Scripts/build-archive.sh +++ b/Scripts/build-archive.sh @@ -10,6 +10,9 @@ PROJECT_DIR="$(dirname "$0")/.." PRODUCT_NAME="AppCenter-SDK-Apple" PRODUCTS_DIR="$PROJECT_DIR/$PRODUCT_NAME" +# Enable extended globbing. +shopt -s extglob nullglob + # Check if the frameworks are already built. if [ ! -d "$PRODUCTS_DIR/iOS" ] || [ ! -d "$PRODUCTS_DIR/macOS" ] || \ [ ! -d "$PRODUCTS_DIR/tvOS" ] || [ ! -d "$PRODUCTS_DIR/XCFramework" ]; then @@ -26,7 +29,7 @@ fi # Verify bitcode. function verify_bitcode() { - name=${1##*/} + local name=${1##*/} name=${name%.*} otool -l "$1/$name" | grep __LLVM > /dev/null } @@ -52,6 +55,33 @@ if [ ${#invalid_bitcode[@]} -ne 0 ]; then exit 1 fi +# Verify architectures. +function verify_framework_architectures() { + local name=${1##*/} + name=${name%.*} + local archs=($(lipo -archs "$1/$name")) + archs=($(printf '%s\n' "${archs[@]}" | sort)) + required=($(printf '%s\n' "${@:2}" | sort)) + if [[ "${archs[@]}" != "${required[@]}" ]]; then + echo "${1#$PRODUCTS_DIR/} doesn't contain required architectures. It has '${archs[@]}' but '${required[@]}' are required." + return 1 + fi +} +function verify_architectures() { + for framework in $PRODUCTS_DIR/$1; do + verify_framework_architectures "$framework" ${@:2} || return $? + done +} +verify_architectures "iOS/*.framework" armv7 armv7s arm64 arm64e i386 x86_64 || exit $? +verify_architectures "macOS/*.framework" x86_64 || exit $? +verify_architectures "tvOS/*.framework" arm64 i386 x86_64 || exit $? +verify_architectures "XCFramework/*.xcframework/ios-!(*-*)/*.framework" armv7 armv7s arm64 arm64e || exit $? +verify_architectures "XCFramework/*.xcframework/ios-*-maccatalyst/*.framework" x86_64 || exit $? +verify_architectures "XCFramework/*.xcframework/ios-*-simulator/*.framework" i386 x86_64 || exit $? +verify_architectures "XCFramework/*.xcframework/macos-*/*.framework" x86_64 || exit $? +verify_architectures "XCFramework/*.xcframework/tvos-!(*-*)/*.framework" arm64 || exit $? +verify_architectures "XCFramework/*.xcframework/tvos-*-simulator/*.framework" i386 x86_64 || exit $? + # Creates zip archive. # Usage: archive function archive() { From d939bbdc0dbd2f9527742595ced6edaa27330e04 Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Tue, 4 Aug 2020 13:53:50 +0300 Subject: [PATCH 12/34] Fix running script not from project root --- Scripts/build-archive.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scripts/build-archive.sh b/Scripts/build-archive.sh index 9a3067ba23..b5b3ffd14f 100755 --- a/Scripts/build-archive.sh +++ b/Scripts/build-archive.sh @@ -95,7 +95,7 @@ function archive() { cp "$PROJECT_DIR/LICENSE" "$temp_dir/$PRODUCT_NAME" cp "$PROJECT_DIR/README.md" "$temp_dir/$PRODUCT_NAME" cp "$PROJECT_DIR/CHANGELOG.md" "$temp_dir/$PRODUCT_NAME" - cp -R "${@:2}" "$temp_dir/$PRODUCT_NAME" + (cd "$PROJECT_DIR" && cp -R "${@:2}" "$temp_dir/$PRODUCT_NAME") # Remmove old archive if exists. if [ -f "$PRODUCTS_DIR/$1" ]; then @@ -122,7 +122,7 @@ archive "$PRODUCT_NAME-$VERSION.carthage.framework.zip" "$PRODUCT_NAME/iOS" "$PR mv "$PRODUCTS_DIR/iOS/AppCenterDistribute.framework/AppCenterDistributeResources.bundle" "$PRODUCTS_DIR/iOS" # Archive XCFrameworks. -archive "$PRODUCT_NAME-XCFramework-$VERSION.zip" $(ls -d "$PRODUCT_NAME/XCFramework"/*) +archive "$PRODUCT_NAME-XCFramework-$VERSION.zip" $(cd "$PROJECT_DIR" && ls -d "$PRODUCT_NAME/XCFramework"/*) # Verify result archives. function verify_symlinks() { From cbef8f8774d9705d59f8e2376bc37057e56cf65f Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Tue, 4 Aug 2020 16:04:20 +0300 Subject: [PATCH 13/34] Add analyze and test yaml for iOS --- .azure-pipelines/analyze-and-test-ios.yml | 41 +++++++++++++++++++++++ .azure-pipelines/analyze-and-test.yml | 7 ++++ 2 files changed, 48 insertions(+) create mode 100644 .azure-pipelines/analyze-and-test-ios.yml create mode 100644 .azure-pipelines/analyze-and-test.yml diff --git a/.azure-pipelines/analyze-and-test-ios.yml b/.azure-pipelines/analyze-and-test-ios.yml new file mode 100644 index 0000000000..27be1e5092 --- /dev/null +++ b/.azure-pipelines/analyze-and-test-ios.yml @@ -0,0 +1,41 @@ +jobs: + - ${{ each module in parameters.modules }}: + - job: + displayName: ${{ format('iOS {0}', module) }} + pool: + vmImage: internal-macos-10.15 + steps: + - task: Xcode@5 + displayName: Analyze + inputs: + actions: analyze + xcWorkspacePath: AppCenter.xcworkspace + scheme: '${{ module }} iOS Framework' + xcodeVersion: specifyPath + xcodeDeveloperDir: '$(XCODE_PATH)' + destinationPlatformOption: iOS + destinationSimulators: 'iPhone 11' + + - task: Xcode@5 + displayName: Test + inputs: + actions: test + xcWorkspacePath: AppCenter.xcworkspace + scheme: '${{ module }} iOS Framework' + xcodeVersion: specifyPath + xcodeDeveloperDir: '$(XCODE_PATH)' + destinationPlatformOption: iOS + destinationSimulators: 'iPhone 11' + publishJUnitResults: true + timeoutInMinutes: 10 + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Diagnostic Reports' + inputs: + PathtoPublish: /Users/runner/Library/Logs/DiagnosticReports + ArtifactName: 'Test Diagnostic Reports' + condition: failed() + + - bash: 'bash <(curl -s https://codecov.io/bash) -X gcov -cF iOS' + displayName: 'Upload Coverage Report to Codecov' + diff --git a/.azure-pipelines/analyze-and-test.yml b/.azure-pipelines/analyze-and-test.yml new file mode 100644 index 0000000000..44b904be0f --- /dev/null +++ b/.azure-pipelines/analyze-and-test.yml @@ -0,0 +1,7 @@ +variables: + XCODE_PATH: '/Applications/Xcode_11.5.app/Contents/Developer' + +jobs: +- template: analyze-and-test-ios.yml + parameters: + modules: [ AppCenter, AppCenterAnalytics, AppCenterCrashes, AppCenterDistribute, AppCenterPush ] From 5f0662f69f862b05877de233d379bce40944d757 Mon Sep 17 00:00:00 2001 From: Anastasia Kubova Date: Tue, 4 Aug 2020 14:37:09 +0300 Subject: [PATCH 14/34] Resolve feedback --- Scripts/sort-schemes.sh | 150 ++++++++++++++++++++-------------------- 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/Scripts/sort-schemes.sh b/Scripts/sort-schemes.sh index 19ecc32fa7..d85cbebd57 100755 --- a/Scripts/sort-schemes.sh +++ b/Scripts/sort-schemes.sh @@ -20,81 +20,81 @@ regexStartHiddenScheme="[a-zA-z -^#.]*<\/key>[${aliasNewLine}][[:space:]]*< regexEndHiddenScheme="orderHint<\/key>[${aliasNewLine}][[:space:]]*[0-9]*<\/integer>[${aliasNewLine}][[:space:]]*<\/dict>" # Scheme counter. -currentSchemeNumber=0; - -replace_number_or_hide_scheme() { - - # Get params. - projectName=$1 - isHidden=$2 - - # Build path to file of scheme. - fileName="${projectName}/xcuserdata/$USER.xcuserdatad/xcschemes/xcschememanagement.plist" - - # Prepare the backup file. - backupFile="${fileName}.bak" - - # Set the start of regex based on isHidden value. - if $isHidden ; then - lastRegex=$regexStartHiddenScheme - else - lastRegex=$regexStartPlaceNumber - fi - isNotEnd=true - - # Check that the scheme file exists. - if [ -f "$fileName" ] ; then - while ($isNotEnd) ; do - if $isHidden ; then - - # Regex for search the place for hide the scheme. - pattern="(${lastRegex})(${regexEndHiddenScheme})" - - # Regex for hidden scheme. - replacePattern="\1$regexHiddenScheme\2" - else - - # Regex for search the number of scheme. - pattern="(${lastRegex})\d+(${regexEndPlaceNumber})" - - # Regex for replacing the number of scheme. - replacePattern="\1${aliasNumber}${currentSchemeNumber}\2" - fi - - # Replace new line to alias. - tr '\n' "${aliasNewLine}" < ${fileName} > ${backupFile} - - # Replace number of scheme. - perl -i -pe "s/${pattern}/${replacePattern}/" ${backupFile} - - # This is a fix to avoid problems with inserting number value via perl. - perl -i -pe "s/${aliasNumber}//" ${backupFile} - - # Replace new line alias to new line symbol. - tr ${aliasNewLine} '\n' < ${backupFile} > ${fileName} - - # Build regex the for next scheme place. - if $isHidden ; then - lastRegex="${lastRegex}${regexHiddenScheme}${regexEndHiddenScheme}${aliasNewLine}[[:space:]]*${regexStartHiddenScheme}" - else - lastRegex="${lastRegex}[0-9]*${regexEndPlaceNumber}${aliasNewLine}[[:space:]]*${regexStartPlaceNumber}" - fi - - # Check that the file still has matches for the given regex. - countMatches=$(cat ${backupFile} | grep -o "$lastRegex" | wc -l) - if (( $countMatches < 1 )) ; then - isNotEnd=false - fi - - # Increase schemes number - currentSchemeNumber=$((currentSchemeNumber+1)) - - # Remove backup file. - rm ${backupFile} - done - else - echo "The schemes configuration does not exist for the project ${projectName}." - fi +currentSchemeNumber=0 + +function replace_number_or_hide_scheme() { + + # Get parameters. + local projectName=$1 + local isHidden=$2 + local isNotEnd=true + + # Build path to file of scheme. + local fileName="${projectName}/xcuserdata/$USER.xcuserdatad/xcschemes/xcschememanagement.plist" + + # Prepare the backup file. + local backupFile="${fileName}.bak" + + # Set the start of regex based on isHidden value. + if $isHidden; then + lastRegex=$regexStartHiddenScheme + else + lastRegex=$regexStartPlaceNumber + fi + + # Check that the scheme file exists. + if [ -f "$fileName" ]; then + while $isNotEnd; do + if $isHidden; then + + # Regex for search the place for hide the scheme. + pattern="(${lastRegex})(${regexEndHiddenScheme})" + + # Regex for hidden scheme. + replacePattern="\1$regexHiddenScheme\2" + else + + # Regex for search the number of scheme. + pattern="(${lastRegex})\d+(${regexEndPlaceNumber})" + + # Regex for replacing the number of scheme. + replacePattern="\1${aliasNumber}${currentSchemeNumber}\2" + fi + + # Replace new line to alias. + tr '\n' "${aliasNewLine}" < "${fileName}" > "${backupFile}" + + # Replace number or hide the scheme. + perl -i -pe "s/${pattern}/${replacePattern}/" "${backupFile}" + + # This is a fix to avoid problems with inserting number value via perl. + perl -i -pe "s/${aliasNumber}//" "${backupFile}" + + # Replace new line alias to new line symbol. + tr ${aliasNewLine} '\n' < "${backupFile}" > "${fileName}" + + # Build regex the for next scheme place. + if $isHidden; then + lastRegex="${lastRegex}${regexHiddenScheme}${regexEndHiddenScheme}${aliasNewLine}[[:space:]]*${regexStartHiddenScheme}" + else + lastRegex="${lastRegex}[0-9]*${regexEndPlaceNumber}${aliasNewLine}[[:space:]]*${regexStartPlaceNumber}" + fi + + # Check that the file still has matches for the given regex. + local countMatches=$(cat "${backupFile}" | grep -o "$lastRegex" | wc -l) + if (( $countMatches < 1 )); then + isNotEnd=false + fi + + # Increase schemes number + currentSchemeNumber=$((currentSchemeNumber+1)) + + # Remove backup file. + rm "${backupFile}" + done + else + echo "The schemes configuration does not exist for the project ${projectName}." + fi } # Sort scheme in the AppCenter.xcworkspace project. From 7c50ee71f2879c82ff95ffbb44898369b39c887d Mon Sep 17 00:00:00 2001 From: Anastasia Kubova Date: Tue, 4 Aug 2020 17:13:42 +0300 Subject: [PATCH 15/34] Formatting --- Scripts/sort-schemes.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Scripts/sort-schemes.sh b/Scripts/sort-schemes.sh index d85cbebd57..0a26beb708 100755 --- a/Scripts/sort-schemes.sh +++ b/Scripts/sort-schemes.sh @@ -47,18 +47,18 @@ function replace_number_or_hide_scheme() { while $isNotEnd; do if $isHidden; then - # Regex for search the place for hide the scheme. - pattern="(${lastRegex})(${regexEndHiddenScheme})" + # Regex for search the place for hide the scheme. + pattern="(${lastRegex})(${regexEndHiddenScheme})" - # Regex for hidden scheme. - replacePattern="\1$regexHiddenScheme\2" + # Regex for hidden scheme. + replacePattern="\1$regexHiddenScheme\2" else - # Regex for search the number of scheme. - pattern="(${lastRegex})\d+(${regexEndPlaceNumber})" + # Regex for search the number of scheme. + pattern="(${lastRegex})\d+(${regexEndPlaceNumber})" - # Regex for replacing the number of scheme. - replacePattern="\1${aliasNumber}${currentSchemeNumber}\2" + # Regex for replacing the number of scheme. + replacePattern="\1${aliasNumber}${currentSchemeNumber}\2" fi # Replace new line to alias. From 11668a778b27430ac4b665e3bc3b46722f3a3708 Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Wed, 5 Aug 2020 10:21:04 +0300 Subject: [PATCH 16/34] Explicit set sdk and configuration --- .azure-pipelines/analyze-and-test-ios.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.azure-pipelines/analyze-and-test-ios.yml b/.azure-pipelines/analyze-and-test-ios.yml index 27be1e5092..ed884e2971 100644 --- a/.azure-pipelines/analyze-and-test-ios.yml +++ b/.azure-pipelines/analyze-and-test-ios.yml @@ -9,6 +9,8 @@ jobs: displayName: Analyze inputs: actions: analyze + configuration: Debug + sdk: iphonesimulator xcWorkspacePath: AppCenter.xcworkspace scheme: '${{ module }} iOS Framework' xcodeVersion: specifyPath @@ -20,6 +22,8 @@ jobs: displayName: Test inputs: actions: test + configuration: Debug + sdk: iphonesimulator xcWorkspacePath: AppCenter.xcworkspace scheme: '${{ module }} iOS Framework' xcodeVersion: specifyPath From 8322ee50a9efe666aef73ac1f101ea19a4f99827 Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Wed, 5 Aug 2020 10:51:21 +0300 Subject: [PATCH 17/34] Recursive checkout --- .azure-pipelines/analyze-and-test-ios.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.azure-pipelines/analyze-and-test-ios.yml b/.azure-pipelines/analyze-and-test-ios.yml index ed884e2971..27e665317a 100644 --- a/.azure-pipelines/analyze-and-test-ios.yml +++ b/.azure-pipelines/analyze-and-test-ios.yml @@ -5,6 +5,8 @@ jobs: pool: vmImage: internal-macos-10.15 steps: + - checkout: self + submodules: recursive - task: Xcode@5 displayName: Analyze inputs: From e0e75e1c12ed86bfcfecf12deac0283848bd0614 Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Wed, 5 Aug 2020 11:22:16 +0300 Subject: [PATCH 18/34] Add analyze and test for other platforms --- .../analyze-and-test-catalyst.yml | 42 ++++++++++++++++++ .azure-pipelines/analyze-and-test-ios.yml | 6 +-- .azure-pipelines/analyze-and-test-macos.yml | 41 ++++++++++++++++++ .azure-pipelines/analyze-and-test-tvos.yml | 43 +++++++++++++++++++ .azure-pipelines/analyze-and-test.yml | 14 ++++++ 5 files changed, 141 insertions(+), 5 deletions(-) create mode 100644 .azure-pipelines/analyze-and-test-catalyst.yml create mode 100644 .azure-pipelines/analyze-and-test-macos.yml create mode 100644 .azure-pipelines/analyze-and-test-tvos.yml diff --git a/.azure-pipelines/analyze-and-test-catalyst.yml b/.azure-pipelines/analyze-and-test-catalyst.yml new file mode 100644 index 0000000000..dc249d21c6 --- /dev/null +++ b/.azure-pipelines/analyze-and-test-catalyst.yml @@ -0,0 +1,42 @@ +jobs: + - ${{ each module in parameters.modules }}: + - job: + displayName: ${{ format('Mac Catalyst {0}', module) }} + pool: + vmImage: internal-macos-10.15 + steps: + - checkout: self + submodules: recursive + + - task: Xcode@5 + displayName: Analyze + inputs: + actions: analyze + xcWorkspacePath: AppCenter.xcworkspace + scheme: '${{ module }} iOS Framework' + xcodeVersion: specifyPath + xcodeDeveloperDir: '$(XCODE_PATH)' + destinationPlatformOption: macOS + + - task: Xcode@5 + displayName: Test + inputs: + actions: test + xcWorkspacePath: AppCenter.xcworkspace + scheme: '${{ module }} iOS Framework' + xcodeVersion: specifyPath + xcodeDeveloperDir: '$(XCODE_PATH)' + destinationPlatformOption: macOS + publishJUnitResults: true + timeoutInMinutes: 10 + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Diagnostic Reports' + inputs: + PathtoPublish: /Users/runner/Library/Logs/DiagnosticReports + ArtifactName: 'Test Diagnostic Reports' + condition: failed() + + - bash: 'bash <(curl -s https://codecov.io/bash) -X gcov -cF MacCatalyst' + displayName: 'Upload Coverage Report to Codecov' + diff --git a/.azure-pipelines/analyze-and-test-ios.yml b/.azure-pipelines/analyze-and-test-ios.yml index 27e665317a..f0fd424a8b 100644 --- a/.azure-pipelines/analyze-and-test-ios.yml +++ b/.azure-pipelines/analyze-and-test-ios.yml @@ -7,12 +7,11 @@ jobs: steps: - checkout: self submodules: recursive + - task: Xcode@5 displayName: Analyze inputs: actions: analyze - configuration: Debug - sdk: iphonesimulator xcWorkspacePath: AppCenter.xcworkspace scheme: '${{ module }} iOS Framework' xcodeVersion: specifyPath @@ -24,8 +23,6 @@ jobs: displayName: Test inputs: actions: test - configuration: Debug - sdk: iphonesimulator xcWorkspacePath: AppCenter.xcworkspace scheme: '${{ module }} iOS Framework' xcodeVersion: specifyPath @@ -44,4 +41,3 @@ jobs: - bash: 'bash <(curl -s https://codecov.io/bash) -X gcov -cF iOS' displayName: 'Upload Coverage Report to Codecov' - diff --git a/.azure-pipelines/analyze-and-test-macos.yml b/.azure-pipelines/analyze-and-test-macos.yml new file mode 100644 index 0000000000..d87d1f88ba --- /dev/null +++ b/.azure-pipelines/analyze-and-test-macos.yml @@ -0,0 +1,41 @@ +jobs: + - ${{ each module in parameters.modules }}: + - job: + displayName: ${{ format('macOS {0}', module) }} + pool: + vmImage: internal-macos-10.15 + steps: + - checkout: self + submodules: recursive + + - task: Xcode@5 + displayName: Analyze + inputs: + actions: analyze + xcWorkspacePath: AppCenter.xcworkspace + scheme: '${{ module }} macOS Framework' + xcodeVersion: specifyPath + xcodeDeveloperDir: '$(XCODE_PATH)' + destinationPlatformOption: macOS + + - task: Xcode@5 + displayName: Test + inputs: + actions: test + xcWorkspacePath: AppCenter.xcworkspace + scheme: '${{ module }} macOS Framework' + xcodeVersion: specifyPath + xcodeDeveloperDir: '$(XCODE_PATH)' + destinationPlatformOption: macOS + publishJUnitResults: true + timeoutInMinutes: 10 + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Diagnostic Reports' + inputs: + PathtoPublish: /Users/runner/Library/Logs/DiagnosticReports + ArtifactName: 'Test Diagnostic Reports' + condition: failed() + + - bash: 'bash <(curl -s https://codecov.io/bash) -X gcov -cF macOS' + displayName: 'Upload Coverage Report to Codecov' diff --git a/.azure-pipelines/analyze-and-test-tvos.yml b/.azure-pipelines/analyze-and-test-tvos.yml new file mode 100644 index 0000000000..3fabba597f --- /dev/null +++ b/.azure-pipelines/analyze-and-test-tvos.yml @@ -0,0 +1,43 @@ +jobs: + - ${{ each module in parameters.modules }}: + - job: + displayName: ${{ format('tvOS {0}', module) }} + pool: + vmImage: internal-macos-10.15 + steps: + - checkout: self + submodules: recursive + + - task: Xcode@5 + displayName: Analyze + inputs: + actions: analyze + xcWorkspacePath: AppCenter.xcworkspace + scheme: '$(MODULE_TVOS) tvOS Framework' + xcodeVersion: specifyPath + xcodeDeveloperDir: '$(XCODE_PATH)' + destinationPlatformOption: tvOS + destinationSimulators: 'Apple TV 4K' + + - task: Xcode@5 + displayName: Test + inputs: + actions: test + xcWorkspacePath: AppCenter.xcworkspace + scheme: '$(MODULE_TVOS) tvOS Framework' + xcodeVersion: specifyPath + xcodeDeveloperDir: '$(XCODE_PATH)' + destinationPlatformOption: tvOS + destinationSimulators: 'Apple TV 4K' + publishJUnitResults: true + timeoutInMinutes: 10 + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Diagnostic Reports' + inputs: + PathtoPublish: /Users/runner/Library/Logs/DiagnosticReports + ArtifactName: 'Test Diagnostic Reports' + condition: failed() + + - bash: 'bash <(curl -s https://codecov.io/bash) -X gcov -cF tvOS' + displayName: 'Upload Coverage Report to Codecov' diff --git a/.azure-pipelines/analyze-and-test.yml b/.azure-pipelines/analyze-and-test.yml index 44b904be0f..9be875e54a 100644 --- a/.azure-pipelines/analyze-and-test.yml +++ b/.azure-pipelines/analyze-and-test.yml @@ -1,7 +1,21 @@ variables: + Configuration: Debug + SDK: XCODE_PATH: '/Applications/Xcode_11.5.app/Contents/Developer' jobs: - template: analyze-and-test-ios.yml parameters: modules: [ AppCenter, AppCenterAnalytics, AppCenterCrashes, AppCenterDistribute, AppCenterPush ] + +- template: analyze-and-test-macos.yml + parameters: + modules: [ AppCenter, AppCenterAnalytics, AppCenterCrashes, AppCenterPush ] + +- template: analyze-and-test-tvos.yml + parameters: + modules: [ AppCenter, AppCenterAnalytics, AppCenterCrashes ] + +- template: analyze-and-test-catalyst.yml + parameters: + modules: [ AppCenter, AppCenterAnalytics, AppCenterCrashes ] From 65c36be683c6475a93385e55c518123b3f6074fe Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Wed, 5 Aug 2020 11:52:13 +0300 Subject: [PATCH 19/34] Use one template for all platforms --- .../analyze-and-test-catalyst.yml | 42 ------------ .azure-pipelines/analyze-and-test-ios.yml | 43 ------------ .azure-pipelines/analyze-and-test-macos.yml | 41 ------------ .../analyze-and-test-template.yml | 65 +++++++++++++++++++ .azure-pipelines/analyze-and-test-tvos.yml | 43 ------------ .azure-pipelines/analyze-and-test.yml | 12 ++-- 6 files changed, 73 insertions(+), 173 deletions(-) delete mode 100644 .azure-pipelines/analyze-and-test-catalyst.yml delete mode 100644 .azure-pipelines/analyze-and-test-ios.yml delete mode 100644 .azure-pipelines/analyze-and-test-macos.yml create mode 100644 .azure-pipelines/analyze-and-test-template.yml delete mode 100644 .azure-pipelines/analyze-and-test-tvos.yml diff --git a/.azure-pipelines/analyze-and-test-catalyst.yml b/.azure-pipelines/analyze-and-test-catalyst.yml deleted file mode 100644 index dc249d21c6..0000000000 --- a/.azure-pipelines/analyze-and-test-catalyst.yml +++ /dev/null @@ -1,42 +0,0 @@ -jobs: - - ${{ each module in parameters.modules }}: - - job: - displayName: ${{ format('Mac Catalyst {0}', module) }} - pool: - vmImage: internal-macos-10.15 - steps: - - checkout: self - submodules: recursive - - - task: Xcode@5 - displayName: Analyze - inputs: - actions: analyze - xcWorkspacePath: AppCenter.xcworkspace - scheme: '${{ module }} iOS Framework' - xcodeVersion: specifyPath - xcodeDeveloperDir: '$(XCODE_PATH)' - destinationPlatformOption: macOS - - - task: Xcode@5 - displayName: Test - inputs: - actions: test - xcWorkspacePath: AppCenter.xcworkspace - scheme: '${{ module }} iOS Framework' - xcodeVersion: specifyPath - xcodeDeveloperDir: '$(XCODE_PATH)' - destinationPlatformOption: macOS - publishJUnitResults: true - timeoutInMinutes: 10 - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Diagnostic Reports' - inputs: - PathtoPublish: /Users/runner/Library/Logs/DiagnosticReports - ArtifactName: 'Test Diagnostic Reports' - condition: failed() - - - bash: 'bash <(curl -s https://codecov.io/bash) -X gcov -cF MacCatalyst' - displayName: 'Upload Coverage Report to Codecov' - diff --git a/.azure-pipelines/analyze-and-test-ios.yml b/.azure-pipelines/analyze-and-test-ios.yml deleted file mode 100644 index f0fd424a8b..0000000000 --- a/.azure-pipelines/analyze-and-test-ios.yml +++ /dev/null @@ -1,43 +0,0 @@ -jobs: - - ${{ each module in parameters.modules }}: - - job: - displayName: ${{ format('iOS {0}', module) }} - pool: - vmImage: internal-macos-10.15 - steps: - - checkout: self - submodules: recursive - - - task: Xcode@5 - displayName: Analyze - inputs: - actions: analyze - xcWorkspacePath: AppCenter.xcworkspace - scheme: '${{ module }} iOS Framework' - xcodeVersion: specifyPath - xcodeDeveloperDir: '$(XCODE_PATH)' - destinationPlatformOption: iOS - destinationSimulators: 'iPhone 11' - - - task: Xcode@5 - displayName: Test - inputs: - actions: test - xcWorkspacePath: AppCenter.xcworkspace - scheme: '${{ module }} iOS Framework' - xcodeVersion: specifyPath - xcodeDeveloperDir: '$(XCODE_PATH)' - destinationPlatformOption: iOS - destinationSimulators: 'iPhone 11' - publishJUnitResults: true - timeoutInMinutes: 10 - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Diagnostic Reports' - inputs: - PathtoPublish: /Users/runner/Library/Logs/DiagnosticReports - ArtifactName: 'Test Diagnostic Reports' - condition: failed() - - - bash: 'bash <(curl -s https://codecov.io/bash) -X gcov -cF iOS' - displayName: 'Upload Coverage Report to Codecov' diff --git a/.azure-pipelines/analyze-and-test-macos.yml b/.azure-pipelines/analyze-and-test-macos.yml deleted file mode 100644 index d87d1f88ba..0000000000 --- a/.azure-pipelines/analyze-and-test-macos.yml +++ /dev/null @@ -1,41 +0,0 @@ -jobs: - - ${{ each module in parameters.modules }}: - - job: - displayName: ${{ format('macOS {0}', module) }} - pool: - vmImage: internal-macos-10.15 - steps: - - checkout: self - submodules: recursive - - - task: Xcode@5 - displayName: Analyze - inputs: - actions: analyze - xcWorkspacePath: AppCenter.xcworkspace - scheme: '${{ module }} macOS Framework' - xcodeVersion: specifyPath - xcodeDeveloperDir: '$(XCODE_PATH)' - destinationPlatformOption: macOS - - - task: Xcode@5 - displayName: Test - inputs: - actions: test - xcWorkspacePath: AppCenter.xcworkspace - scheme: '${{ module }} macOS Framework' - xcodeVersion: specifyPath - xcodeDeveloperDir: '$(XCODE_PATH)' - destinationPlatformOption: macOS - publishJUnitResults: true - timeoutInMinutes: 10 - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Diagnostic Reports' - inputs: - PathtoPublish: /Users/runner/Library/Logs/DiagnosticReports - ArtifactName: 'Test Diagnostic Reports' - condition: failed() - - - bash: 'bash <(curl -s https://codecov.io/bash) -X gcov -cF macOS' - displayName: 'Upload Coverage Report to Codecov' diff --git a/.azure-pipelines/analyze-and-test-template.yml b/.azure-pipelines/analyze-and-test-template.yml new file mode 100644 index 0000000000..d4c26a7a53 --- /dev/null +++ b/.azure-pipelines/analyze-and-test-template.yml @@ -0,0 +1,65 @@ +parameters: +- name: platform + type: string + +- name: modules + type: object + +jobs: +- ${{ each module in parameters.modules }}: + - job: + displayName: ${{ format('{0} {1}', parameters.platform, module) }} + pool: + vmImage: internal-macos-10.15 + steps: + - checkout: self + submodules: recursive + + - task: Xcode@5 + displayName: Analyze + inputs: + actions: analyze + xcWorkspacePath: AppCenter.xcworkspace + xcodeVersion: specifyPath + xcodeDeveloperDir: '$(XCODE_PATH)' + ${{ if eq(parameters.platform, 'MacCatalyst') }}: + scheme: '${{ module }} iOS Framework' + destinationPlatformOption: macOS + ${{ if ne(parameters.platform, 'MacCatalyst') }}: + scheme: '${{ module }} ${{ parameters.platform }} Framework' + destinationPlatformOption: ${{ parameters.platform }} + ${{ if eq(parameters.platform, 'iOS') }}: + destinationSimulators: 'iPhone 11' + ${{ if eq(parameters.platform, 'tvOS') }}: + destinationSimulators: 'Apple TV' + + - task: Xcode@5 + displayName: Test + inputs: + actions: test + xcWorkspacePath: AppCenter.xcworkspace + xcodeVersion: specifyPath + xcodeDeveloperDir: '$(XCODE_PATH)' + ${{ if eq(parameters.platform, 'MacCatalyst') }}: + scheme: '${{ module }} iOS Framework' + destinationPlatformOption: macOS + ${{ if ne(parameters.platform, 'MacCatalyst') }}: + scheme: '${{ module }} ${{ parameters.platform }} Framework' + destinationPlatformOption: ${{ parameters.platform }} + ${{ if eq(parameters.platform, 'iOS') }}: + destinationSimulators: 'iPhone 11' + ${{ if eq(parameters.platform, 'tvOS') }}: + destinationSimulators: 'Apple TV' + publishJUnitResults: true + timeoutInMinutes: 10 + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Diagnostic Reports' + inputs: + PathtoPublish: /Users/runner/Library/Logs/DiagnosticReports + ArtifactName: 'Test Diagnostic Reports' + condition: failed() + + - bash: 'bash <(curl -s https://codecov.io/bash) -X gcov -cF ${{ parameters.platform }}' + displayName: 'Upload Coverage Report to Codecov' + diff --git a/.azure-pipelines/analyze-and-test-tvos.yml b/.azure-pipelines/analyze-and-test-tvos.yml deleted file mode 100644 index 3fabba597f..0000000000 --- a/.azure-pipelines/analyze-and-test-tvos.yml +++ /dev/null @@ -1,43 +0,0 @@ -jobs: - - ${{ each module in parameters.modules }}: - - job: - displayName: ${{ format('tvOS {0}', module) }} - pool: - vmImage: internal-macos-10.15 - steps: - - checkout: self - submodules: recursive - - - task: Xcode@5 - displayName: Analyze - inputs: - actions: analyze - xcWorkspacePath: AppCenter.xcworkspace - scheme: '$(MODULE_TVOS) tvOS Framework' - xcodeVersion: specifyPath - xcodeDeveloperDir: '$(XCODE_PATH)' - destinationPlatformOption: tvOS - destinationSimulators: 'Apple TV 4K' - - - task: Xcode@5 - displayName: Test - inputs: - actions: test - xcWorkspacePath: AppCenter.xcworkspace - scheme: '$(MODULE_TVOS) tvOS Framework' - xcodeVersion: specifyPath - xcodeDeveloperDir: '$(XCODE_PATH)' - destinationPlatformOption: tvOS - destinationSimulators: 'Apple TV 4K' - publishJUnitResults: true - timeoutInMinutes: 10 - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Diagnostic Reports' - inputs: - PathtoPublish: /Users/runner/Library/Logs/DiagnosticReports - ArtifactName: 'Test Diagnostic Reports' - condition: failed() - - - bash: 'bash <(curl -s https://codecov.io/bash) -X gcov -cF tvOS' - displayName: 'Upload Coverage Report to Codecov' diff --git a/.azure-pipelines/analyze-and-test.yml b/.azure-pipelines/analyze-and-test.yml index 9be875e54a..dc8491dd1a 100644 --- a/.azure-pipelines/analyze-and-test.yml +++ b/.azure-pipelines/analyze-and-test.yml @@ -4,18 +4,22 @@ variables: XCODE_PATH: '/Applications/Xcode_11.5.app/Contents/Developer' jobs: -- template: analyze-and-test-ios.yml +- template: analyze-and-test-template.yml parameters: + platform: iOS modules: [ AppCenter, AppCenterAnalytics, AppCenterCrashes, AppCenterDistribute, AppCenterPush ] -- template: analyze-and-test-macos.yml +- template: analyze-and-test-template.yml parameters: + platform: macOS modules: [ AppCenter, AppCenterAnalytics, AppCenterCrashes, AppCenterPush ] -- template: analyze-and-test-tvos.yml +- template: analyze-and-test-template.yml parameters: + platform: tvOS modules: [ AppCenter, AppCenterAnalytics, AppCenterCrashes ] -- template: analyze-and-test-catalyst.yml +- template: analyze-and-test-template.yml parameters: + platform: MacCatalyst modules: [ AppCenter, AppCenterAnalytics, AppCenterCrashes ] From 3a143d226abb9aea5a29879147cf533b16ca792b Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Wed, 5 Aug 2020 14:41:47 +0300 Subject: [PATCH 20/34] Build frameworks pipeline --- .../build-frameworks-and-docs.yml | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .azure-pipelines/build-frameworks-and-docs.yml diff --git a/.azure-pipelines/build-frameworks-and-docs.yml b/.azure-pipelines/build-frameworks-and-docs.yml new file mode 100644 index 0000000000..7bdf82aa2a --- /dev/null +++ b/.azure-pipelines/build-frameworks-and-docs.yml @@ -0,0 +1,80 @@ +pool: + vmImage: internal-macos-10.15 + +variables: + Configuration: Release + SDK: + + # Xcode 11.3.1 version is the last one that has compatible bitcode with Xcode 11.0 (minimal supported). + XCODE_PATH: '/Applications/Xcode_11.3.1.app/Contents/Developer' + +jobs: +- job: + displayName: Build SDK for All Platforms + steps: + - checkout: self + submodules: recursive + + - bash: | + version="$(Scripts/framework-version.sh)+$(git rev-parse --short $BUILD_SOURCEVERSION)" + echo "Change version to $version" + Scripts/framework-version.sh "$version" + displayName: 'Update Version' + condition: ne(variables['Build.SourceBranch'], 'refs/heads/master') + + - bash: 'sudo gem install jazzy --no-document' + displayName: 'Install Jazzy' + + - task: Xcode@5 + displayName: Build + inputs: + xcWorkspacePath: AppCenter.xcworkspace + scheme: 'All Frameworks+Documentation' + xcodeVersion: specifyPath + xcodeDeveloperDir: '$(XCODE_PATH)' + timeoutInMinutes: 15 + + - task: Bash@3 + displayName: Archive + inputs: + targetType: filePath + filePath: './Scripts/build-archive.sh' + + - task: CopyFiles@2 + displayName: 'Copy Archives to Staging Directory' + inputs: + SourceFolder: './AppCenter-SDK-Apple' + Contents: '**/AppCenter-SDK-Apple*.zip' + TargetFolder: '$(Build.ArtifactStagingDirectory)' + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Artifacts' + inputs: + ArtifactName: Release + +- job: + displayName: Version Information + steps: + - bash: | + swift --version + swift package describe + displayName: 'Print Swift Package Information' + + - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 + displayName: 'Component Detection' + inputs: + failOnAlert: true + + - bash: | + VERSION=$(Scripts/framework-version.sh) + mkdir -p $(Build.ArtifactStagingDirectory)/Info + echo $VERSION > $(Build.ArtifactStagingDirectory)/Info/VERSION + echo $BUILD_SOURCEVERSION > $(Build.ArtifactStagingDirectory)/Info/COMMIT + Scripts/get-release-notes.sh $VERSION > $(Build.ArtifactStagingDirectory)/Info/RELEASE.md + displayName: 'Collect Version Information' + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Version Information' + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)/Info' + ArtifactName: Info From 4bb0751eea61bdd0d12b4ff3b62dadb3a2a7ec53 Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Wed, 5 Aug 2020 14:51:16 +0300 Subject: [PATCH 21/34] Use default (latest) Xcode for analyze and test --- .azure-pipelines/analyze-and-test-template.yml | 4 ---- .azure-pipelines/analyze-and-test.yml | 1 - 2 files changed, 5 deletions(-) diff --git a/.azure-pipelines/analyze-and-test-template.yml b/.azure-pipelines/analyze-and-test-template.yml index d4c26a7a53..cedef4a7ae 100644 --- a/.azure-pipelines/analyze-and-test-template.yml +++ b/.azure-pipelines/analyze-and-test-template.yml @@ -20,8 +20,6 @@ jobs: inputs: actions: analyze xcWorkspacePath: AppCenter.xcworkspace - xcodeVersion: specifyPath - xcodeDeveloperDir: '$(XCODE_PATH)' ${{ if eq(parameters.platform, 'MacCatalyst') }}: scheme: '${{ module }} iOS Framework' destinationPlatformOption: macOS @@ -38,8 +36,6 @@ jobs: inputs: actions: test xcWorkspacePath: AppCenter.xcworkspace - xcodeVersion: specifyPath - xcodeDeveloperDir: '$(XCODE_PATH)' ${{ if eq(parameters.platform, 'MacCatalyst') }}: scheme: '${{ module }} iOS Framework' destinationPlatformOption: macOS diff --git a/.azure-pipelines/analyze-and-test.yml b/.azure-pipelines/analyze-and-test.yml index dc8491dd1a..9d5e135487 100644 --- a/.azure-pipelines/analyze-and-test.yml +++ b/.azure-pipelines/analyze-and-test.yml @@ -1,7 +1,6 @@ variables: Configuration: Debug SDK: - XCODE_PATH: '/Applications/Xcode_11.5.app/Contents/Developer' jobs: - template: analyze-and-test-template.yml From e92e3c4d71995ace5d32f14b8248ef94513c3588 Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Wed, 5 Aug 2020 15:04:59 +0300 Subject: [PATCH 22/34] Build test apps pipeline --- .azure-pipelines/build-test-apps.yml | 94 ++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 .azure-pipelines/build-test-apps.yml diff --git a/.azure-pipelines/build-test-apps.yml b/.azure-pipelines/build-test-apps.yml new file mode 100644 index 0000000000..a02e35206c --- /dev/null +++ b/.azure-pipelines/build-test-apps.yml @@ -0,0 +1,94 @@ +pool: + vmImage: internal-macos-10.15 + +variables: + Configuration: Release + SDK: + +jobs: +- job: + displayName: Puppet iOS + steps: + - checkout: self + submodules: recursive + + - task: Xcode@5 + displayName: 'Sasquatch iOS Puppet Archive' + inputs: + actions: archive + xcWorkspacePath: AppCenter.xcworkspace + scheme: SasquatchPuppet + +- job: + displayName: Puppet Mac Catalyst + steps: + - checkout: self + submodules: recursive + + - task: Xcode@5 + displayName: 'Sasquatch Mac Catalyst Puppet Archive' + inputs: + actions: archive + xcWorkspacePath: AppCenter.xcworkspace + scheme: SasquatchPuppet + destinationPlatformOption: macOS + +- job: + displayName: Sasquatch iOS + steps: + - checkout: self + submodules: recursive + + - task: Xcode@5 + displayName: 'Sasquatch iOS Objective-C Archive' + inputs: + actions: archive + xcWorkspacePath: AppCenter.xcworkspace + scheme: SasquatchObjC + + - task: Xcode@5 + displayName: 'Sasquatch iOS Swift Archive' + inputs: + actions: archive + xcWorkspacePath: AppCenter.xcworkspace + scheme: SasquatchSwift + +- job: + displayName: Sasquatch macOS + steps: + - checkout: self + submodules: recursive + + - task: Xcode@5 + displayName: 'Sasquatch macOS Objective-C Archive' + inputs: + actions: archive + xcWorkspacePath: AppCenter.xcworkspace + scheme: SasquatchMacObjC + + - task: Xcode@5 + displayName: 'Sasquatch macOS Swift Archive' + inputs: + actions: archive + xcWorkspacePath: AppCenter.xcworkspace + scheme: SasquatchMacSwift + +- job: + displayName: Sasquatch tvOS + steps: + - checkout: self + submodules: recursive + + - task: Xcode@5 + displayName: 'Sasquatch tvOS Objective-C Archive' + inputs: + actions: archive + xcWorkspacePath: AppCenter.xcworkspace + scheme: SasquatchTVObjC + + - task: Xcode@5 + displayName: 'Sasquatch tvOS Swift Archive' + inputs: + actions: archive + xcWorkspacePath: AppCenter.xcworkspace + scheme: SasquatchTVSwift From 015a6652de35febbf9d59de7a97648c1eb7bfa8b Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Thu, 6 Aug 2020 14:49:30 +0300 Subject: [PATCH 23/34] Add triggers --- .azure-pipelines/analyze-and-test.yml | 5 +++++ .azure-pipelines/build-frameworks-and-docs.yml | 9 +++++++++ .azure-pipelines/build-test-apps.yml | 5 +++++ 3 files changed, 19 insertions(+) diff --git a/.azure-pipelines/analyze-and-test.yml b/.azure-pipelines/analyze-and-test.yml index 9d5e135487..707737677f 100644 --- a/.azure-pipelines/analyze-and-test.yml +++ b/.azure-pipelines/analyze-and-test.yml @@ -1,3 +1,8 @@ +pr: +- master +- develop +- feature/* + variables: Configuration: Debug SDK: diff --git a/.azure-pipelines/build-frameworks-and-docs.yml b/.azure-pipelines/build-frameworks-and-docs.yml index 7bdf82aa2a..d2899a0ae3 100644 --- a/.azure-pipelines/build-frameworks-and-docs.yml +++ b/.azure-pipelines/build-frameworks-and-docs.yml @@ -1,3 +1,12 @@ +trigger: +- master +- develop + +pr: +- master +- develop +- feature/* + pool: vmImage: internal-macos-10.15 diff --git a/.azure-pipelines/build-test-apps.yml b/.azure-pipelines/build-test-apps.yml index a02e35206c..ef2b949101 100644 --- a/.azure-pipelines/build-test-apps.yml +++ b/.azure-pipelines/build-test-apps.yml @@ -1,3 +1,8 @@ +pr: +- master +- develop +- feature/* + pool: vmImage: internal-macos-10.15 From b49bf54078fa8c4ecb5511b5f57a5ed6a83d44ac Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Mon, 10 Aug 2020 18:37:18 +0300 Subject: [PATCH 24/34] Apply suggestions from code review Co-authored-by: Clement Polet --- Scripts/sort-schemes.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scripts/sort-schemes.sh b/Scripts/sort-schemes.sh index 0a26beb708..24676876c9 100755 --- a/Scripts/sort-schemes.sh +++ b/Scripts/sort-schemes.sh @@ -10,11 +10,11 @@ aliasNewLine='@' aliasNumber='%numberAlias%' -# Regex constans for change number. +# Regex constants for position number. regexStartPlaceNumber="[a-zA-z -^#.]*<\/key>[${aliasNewLine}][[:space:]]*[${aliasNewLine}][[:space:]]*orderHint<\/key>[${aliasNewLine}][[:space:]]*" regexEndPlaceNumber="<\/integer>[${aliasNewLine}][[:space:]]*<\/dict>" -# Regex constans for hidden schemes. +# Regex constants for hidden schemes. regexHiddenScheme="isShown<\/key>" regexStartHiddenScheme="[a-zA-z -^#.]*<\/key>[${aliasNewLine}][[:space:]]*[${aliasNewLine}][[:space:]]*" regexEndHiddenScheme="orderHint<\/key>[${aliasNewLine}][[:space:]]*[0-9]*<\/integer>[${aliasNewLine}][[:space:]]*<\/dict>" From 09e85a7c7b571411590707e497b4c56197abc94b Mon Sep 17 00:00:00 2001 From: Anna Kocheshkova Date: Fri, 7 Aug 2020 11:21:04 +0300 Subject: [PATCH 25/34] Fix sending logs from applicationWillTerminate --- .../Internals/Channel/MSChannelGroupDefault.m | 31 +++++++++++++++++ .../Channel/MSChannelGroupDefaultPrivate.h | 13 ++++++++ .../MSChannelGroupDefaultTests.m | 33 +++++++++++++++++++ CHANGELOG.md | 4 +++ 4 files changed, 81 insertions(+) diff --git a/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m b/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m index 1e381d46c3..be68974fdb 100644 --- a/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m +++ b/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m @@ -13,6 +13,12 @@ @implementation MSChannelGroupDefault +#if !TARGET_OS_OSX + +@synthesize delayedProcessingSemaphore = _delayedProcessingSemaphore; + +#endif + #pragma mark - Initialization - (instancetype)initWithHttpClient:(id)httpClient installId:(NSUUID *)installId logUrl:(NSString *)logUrl { @@ -32,6 +38,9 @@ - (instancetype)initWithIngestion:(nullable MSAppCenterIngestion *)ingestion { if (ingestion) { _ingestion = ingestion; } +#if !TARGET_OS_OSX + _delayedProcessingSemaphore = dispatch_semaphore_create(0); +#endif } return self; } @@ -177,6 +186,17 @@ - (void)channel:(id)channel didResumeWithIdentifyingObject:(i - (void)setEnabled:(BOOL)isEnabled andDeleteDataOnDisabled:(BOOL)deleteData { +#if !TARGET_OS_OSX + if (isEnabled) { + [MS_NOTIFICATION_CENTER addObserver:self + selector:@selector(applicationWillTerminate:) + name:UIApplicationWillTerminateNotification + object:nil]; + } else { + [MS_NOTIFICATION_CENTER removeObserver:self]; + } +#endif + // Propagate to ingestion. [self.ingestion setEnabled:isEnabled andDeleteDataOnDisabled:deleteData]; @@ -199,6 +219,17 @@ - (void)setEnabled:(BOOL)isEnabled andDeleteDataOnDisabled:(BOOL)deleteData { */ } +#if !TARGET_OS_OSX +- (void)applicationWillTerminate:(__unused UIApplication *)application { + + // Block logs queue so that it isn't killed before app termination. + dispatch_async(self.logsDispatchQueue, ^{ + dispatch_semaphore_signal(self.delayedProcessingSemaphore); + }); + dispatch_semaphore_wait(self.delayedProcessingSemaphore, dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC)); +} +#endif + #pragma mark - Pause / Resume - (void)pauseWithIdentifyingObject:(id)identifyingObject { diff --git a/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefaultPrivate.h b/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefaultPrivate.h index befe90615b..f3c1547b4d 100644 --- a/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefaultPrivate.h +++ b/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefaultPrivate.h @@ -18,6 +18,19 @@ NS_ASSUME_NONNULL_BEGIN */ - (instancetype)initWithIngestion:(nullable MSAppCenterIngestion *)ingestion; +#if !TARGET_OS_OSX +/** + * Semaphore for blocking logs queue on applicationWillTerminate. + */ +@property dispatch_semaphore_t delayedProcessingSemaphore; + +/** + * Called when applciation is terminating. + */ +- (void)applicationWillTerminate:(__unused UIApplication *)application; + +#endif + @end NS_ASSUME_NONNULL_END diff --git a/AppCenter/AppCenterTests/MSChannelGroupDefaultTests.m b/AppCenter/AppCenterTests/MSChannelGroupDefaultTests.m index 2ebc787b03..8e7c709bc4 100644 --- a/AppCenter/AppCenterTests/MSChannelGroupDefaultTests.m +++ b/AppCenter/AppCenterTests/MSChannelGroupDefaultTests.m @@ -1,6 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +#import "TargetConditionals.h" +#if !TARGET_OS_OSX +#import +#endif + #import "MSAbstractLogInternal.h" #import "MSAppCenterIngestion.h" #import "MSChannelDelegate.h" @@ -61,6 +66,34 @@ - (void)tearDown { [super tearDown]; } +#if !TARGET_OS_OSX +- (void)testAppIsKilled { + + // If + [self.sut setEnabled:YES andDeleteDataOnDisabled:YES]; + id sut = OCMPartialMock(self.sut); + + // When + [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationWillTerminateNotification object:sut]; + + // Then + OCMVerify([sut applicationWillTerminate:OCMOCK_ANY]); + XCTAssertNotNil(self.sut.logsDispatchQueue); + + // If + [self.sut setEnabled:NO andDeleteDataOnDisabled:YES]; + OCMReject([sut applicationWillTerminate:OCMOCK_ANY]); + + // When + [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationWillTerminateNotification object:sut]; + + // Then + self.sut.logsDispatchQueue = nil; + OCMVerifyAll(sut); + [sut stopMocking]; +} +#endif + #pragma mark - Tests - (void)testNewInstanceWasInitialisedCorrectly { diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ea91d3b3b..0455282854 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ * **[Fix]** Fix compatibility with Xcode 12 beta when integrating SDK from sources. +### App Center Analytics + +* **[Fix]** Fix sending logs from `applicationWillTerminate`. + ___ ## Version 3.3.2 From 2aad88575909bef274790c409feeced87a54a6a2 Mon Sep 17 00:00:00 2001 From: Anna Kocheshkova Date: Mon, 17 Aug 2020 11:30:04 +0300 Subject: [PATCH 26/34] Separate method into util --- .../Internals/Channel/MSChannelGroupDefault.m | 15 ++------------- .../AppCenter/Internals/Util/MSDispatcherUtil.h | 2 ++ .../AppCenter/Internals/Util/MSDispatcherUtil.m | 7 +++++++ .../AppCenterTests/MSChannelGroupDefaultTests.m | 6 +++--- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m b/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m index be68974fdb..63123570d9 100644 --- a/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m +++ b/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m @@ -7,18 +7,13 @@ #import "MSChannelGroupDefaultPrivate.h" #import "MSChannelUnitConfiguration.h" #import "MSChannelUnitDefault.h" +#import "MSDispatcherUtil.h" #import "MSLogDBStorage.h" static char *const kMSLogsDispatchQueue = "com.microsoft.appcenter.ChannelGroupQueue"; @implementation MSChannelGroupDefault -#if !TARGET_OS_OSX - -@synthesize delayedProcessingSemaphore = _delayedProcessingSemaphore; - -#endif - #pragma mark - Initialization - (instancetype)initWithHttpClient:(id)httpClient installId:(NSUUID *)installId logUrl:(NSString *)logUrl { @@ -38,9 +33,6 @@ - (instancetype)initWithIngestion:(nullable MSAppCenterIngestion *)ingestion { if (ingestion) { _ingestion = ingestion; } -#if !TARGET_OS_OSX - _delayedProcessingSemaphore = dispatch_semaphore_create(0); -#endif } return self; } @@ -223,10 +215,7 @@ - (void)setEnabled:(BOOL)isEnabled andDeleteDataOnDisabled:(BOOL)deleteData { - (void)applicationWillTerminate:(__unused UIApplication *)application { // Block logs queue so that it isn't killed before app termination. - dispatch_async(self.logsDispatchQueue, ^{ - dispatch_semaphore_signal(self.delayedProcessingSemaphore); - }); - dispatch_semaphore_wait(self.delayedProcessingSemaphore, dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC)); + [MSDispatcherUtil blockQueue:self.logsDispatchQueue]; } #endif diff --git a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h index 445192012b..b398c3b868 100644 --- a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h +++ b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h @@ -14,4 +14,6 @@ + (void)performBlockOnMainThread:(void (^)(void))block; ++ (void)blockQueue:(dispatch_queue_t)dispatchQueue; + @end diff --git a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m index 05302a9f45..c84430b143 100644 --- a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m +++ b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m @@ -23,4 +23,11 @@ + (void)runBlock:(void (^)(void))block { block(); } ++ (void)blockQueue:(dispatch_queue_t)dispatchQueue { + dispatch_semaphore_t delayedProcessingSemaphore = dispatch_semaphore_create(0); + dispatch_async(dispatchQueue, ^{ + dispatch_semaphore_signal(delayedProcessingSemaphore); + }); + dispatch_semaphore_wait(delayedProcessingSemaphore, dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC)); +} @end diff --git a/AppCenter/AppCenterTests/MSChannelGroupDefaultTests.m b/AppCenter/AppCenterTests/MSChannelGroupDefaultTests.m index 8e7c709bc4..33564c446c 100644 --- a/AppCenter/AppCenterTests/MSChannelGroupDefaultTests.m +++ b/AppCenter/AppCenterTests/MSChannelGroupDefaultTests.m @@ -79,14 +79,14 @@ - (void)testAppIsKilled { // Then OCMVerify([sut applicationWillTerminate:OCMOCK_ANY]); XCTAssertNotNil(self.sut.logsDispatchQueue); - + // If [self.sut setEnabled:NO andDeleteDataOnDisabled:YES]; OCMReject([sut applicationWillTerminate:OCMOCK_ANY]); - + // When [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationWillTerminateNotification object:sut]; - + // Then self.sut.logsDispatchQueue = nil; OCMVerifyAll(sut); From 08ec47096b338630cdc1dc61447242d51f92b909 Mon Sep 17 00:00:00 2001 From: Anna Kocheshkova Date: Mon, 17 Aug 2020 11:39:59 +0300 Subject: [PATCH 27/34] Rename method, do some cleanup --- .../AppCenter/Internals/Channel/MSChannelGroupDefault.m | 2 +- .../Internals/Channel/MSChannelGroupDefaultPrivate.h | 7 ++----- AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h | 7 ++++++- AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m | 4 ++-- AppCenter/AppCenterTests/MSChannelGroupDefaultTests.m | 5 ----- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m b/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m index 63123570d9..5e50a9f9ed 100644 --- a/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m +++ b/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m @@ -215,7 +215,7 @@ - (void)setEnabled:(BOOL)isEnabled andDeleteDataOnDisabled:(BOOL)deleteData { - (void)applicationWillTerminate:(__unused UIApplication *)application { // Block logs queue so that it isn't killed before app termination. - [MSDispatcherUtil blockQueue:self.logsDispatchQueue]; + [MSDispatcherUtil dispatchAsyncWithTimeout:1 onQueue:self.logsDispatchQueue]; } #endif diff --git a/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefaultPrivate.h b/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefaultPrivate.h index f3c1547b4d..007ce1b50b 100644 --- a/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefaultPrivate.h +++ b/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefaultPrivate.h @@ -6,6 +6,7 @@ NS_ASSUME_NONNULL_BEGIN @class MSAppCenterIngestion; +@class UIApplication; @interface MSChannelGroupDefault () @@ -19,15 +20,11 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithIngestion:(nullable MSAppCenterIngestion *)ingestion; #if !TARGET_OS_OSX -/** - * Semaphore for blocking logs queue on applicationWillTerminate. - */ -@property dispatch_semaphore_t delayedProcessingSemaphore; /** * Called when applciation is terminating. */ -- (void)applicationWillTerminate:(__unused UIApplication *)application; +- (void)applicationWillTerminate:(UIApplication *)application; #endif diff --git a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h index b398c3b868..07c92b18e0 100644 --- a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h +++ b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h @@ -14,6 +14,11 @@ + (void)performBlockOnMainThread:(void (^)(void))block; -+ (void)blockQueue:(dispatch_queue_t)dispatchQueue; +/** + * Adds a dispatch_async block to the provided queue and waits for its execution. + * @param timeout timeout for waiting in seconds. + * @param dispatchQueue the queue to perform block on. + */ ++ (void)dispatchAsyncWithTimeout:(int)timeout onQueue:(dispatch_queue_t)dispatchQueue; @end diff --git a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m index c84430b143..487f0a2b8d 100644 --- a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m +++ b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m @@ -23,11 +23,11 @@ + (void)runBlock:(void (^)(void))block { block(); } -+ (void)blockQueue:(dispatch_queue_t)dispatchQueue { ++ (void)dispatchAsyncWithTimeout:(int)timeout onQueue:(dispatch_queue_t)dispatchQueue { dispatch_semaphore_t delayedProcessingSemaphore = dispatch_semaphore_create(0); dispatch_async(dispatchQueue, ^{ dispatch_semaphore_signal(delayedProcessingSemaphore); }); - dispatch_semaphore_wait(delayedProcessingSemaphore, dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC)); + dispatch_semaphore_wait(delayedProcessingSemaphore, dispatch_time(DISPATCH_TIME_NOW, timeout * NSEC_PER_SEC)); } @end diff --git a/AppCenter/AppCenterTests/MSChannelGroupDefaultTests.m b/AppCenter/AppCenterTests/MSChannelGroupDefaultTests.m index 33564c446c..45f2f19c36 100644 --- a/AppCenter/AppCenterTests/MSChannelGroupDefaultTests.m +++ b/AppCenter/AppCenterTests/MSChannelGroupDefaultTests.m @@ -1,11 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -#import "TargetConditionals.h" -#if !TARGET_OS_OSX -#import -#endif - #import "MSAbstractLogInternal.h" #import "MSAppCenterIngestion.h" #import "MSChannelDelegate.h" From 54b550fa1b573f17979af427534a815362762246 Mon Sep 17 00:00:00 2001 From: Anna Kocheshkova Date: Mon, 17 Aug 2020 11:58:39 +0300 Subject: [PATCH 28/34] Rename and add block to parameter --- AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m | 3 ++- AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h | 3 ++- AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m b/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m index 5e50a9f9ed..42490cd878 100644 --- a/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m +++ b/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m @@ -215,7 +215,8 @@ - (void)setEnabled:(BOOL)isEnabled andDeleteDataOnDisabled:(BOOL)deleteData { - (void)applicationWillTerminate:(__unused UIApplication *)application { // Block logs queue so that it isn't killed before app termination. - [MSDispatcherUtil dispatchAsyncWithTimeout:1 onQueue:self.logsDispatchQueue]; + [MSDispatcherUtil dispatchSyncWithTimeout:1 onQueue:self.logsDispatchQueue withBlock: ^{ + }]; } #endif diff --git a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h index 07c92b18e0..07ada9bfd2 100644 --- a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h +++ b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h @@ -18,7 +18,8 @@ * Adds a dispatch_async block to the provided queue and waits for its execution. * @param timeout timeout for waiting in seconds. * @param dispatchQueue the queue to perform block on. + * @param block the block to be executed. */ -+ (void)dispatchAsyncWithTimeout:(int)timeout onQueue:(dispatch_queue_t)dispatchQueue; ++ (void)dispatchSyncWithTimeout:(int)timeout onQueue:(dispatch_queue_t)dispatchQueue withBlock:(dispatch_block_t)block; @end diff --git a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m index 487f0a2b8d..98ffd057e8 100644 --- a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m +++ b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m @@ -23,9 +23,10 @@ + (void)runBlock:(void (^)(void))block { block(); } -+ (void)dispatchAsyncWithTimeout:(int)timeout onQueue:(dispatch_queue_t)dispatchQueue { ++ (void)dispatchSyncWithTimeout:(int)timeout onQueue:(dispatch_queue_t)dispatchQueue withBlock:(dispatch_block_t)block { dispatch_semaphore_t delayedProcessingSemaphore = dispatch_semaphore_create(0); dispatch_async(dispatchQueue, ^{ + block(); dispatch_semaphore_signal(delayedProcessingSemaphore); }); dispatch_semaphore_wait(delayedProcessingSemaphore, dispatch_time(DISPATCH_TIME_NOW, timeout * NSEC_PER_SEC)); From f7dd85b41f48c17d98cba3f642b61c50cc7748c1 Mon Sep 17 00:00:00 2001 From: Anna Kocheshkova Date: Mon, 17 Aug 2020 12:26:00 +0300 Subject: [PATCH 29/34] Add tests --- .../Internals/Channel/MSChannelGroupDefault.m | 6 ++- .../Internals/Util/MSDispatcherUtil.h | 2 +- .../Internals/Util/MSDispatcherUtil.m | 4 +- AppCenter/AppCenterTests/MSUtilityTests.m | 47 +++++++++++++++++++ 4 files changed, 54 insertions(+), 5 deletions(-) diff --git a/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m b/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m index 42490cd878..cbc8a75285 100644 --- a/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m +++ b/AppCenter/AppCenter/Internals/Channel/MSChannelGroupDefault.m @@ -215,8 +215,10 @@ - (void)setEnabled:(BOOL)isEnabled andDeleteDataOnDisabled:(BOOL)deleteData { - (void)applicationWillTerminate:(__unused UIApplication *)application { // Block logs queue so that it isn't killed before app termination. - [MSDispatcherUtil dispatchSyncWithTimeout:1 onQueue:self.logsDispatchQueue withBlock: ^{ - }]; + [MSDispatcherUtil dispatchSyncWithTimeout:1 + onQueue:self.logsDispatchQueue + withBlock:^{ + }]; } #endif diff --git a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h index 07ada9bfd2..2cba15afcc 100644 --- a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h +++ b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h @@ -20,6 +20,6 @@ * @param dispatchQueue the queue to perform block on. * @param block the block to be executed. */ -+ (void)dispatchSyncWithTimeout:(int)timeout onQueue:(dispatch_queue_t)dispatchQueue withBlock:(dispatch_block_t)block; ++ (void)dispatchSyncWithTimeout:(float)timeout onQueue:(dispatch_queue_t)dispatchQueue withBlock:(dispatch_block_t)block; @end diff --git a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m index 98ffd057e8..ce543e24f1 100644 --- a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m +++ b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m @@ -23,12 +23,12 @@ + (void)runBlock:(void (^)(void))block { block(); } -+ (void)dispatchSyncWithTimeout:(int)timeout onQueue:(dispatch_queue_t)dispatchQueue withBlock:(dispatch_block_t)block { ++ (void)dispatchSyncWithTimeout:(float)timeout onQueue:(dispatch_queue_t)dispatchQueue withBlock:(dispatch_block_t)block { dispatch_semaphore_t delayedProcessingSemaphore = dispatch_semaphore_create(0); dispatch_async(dispatchQueue, ^{ block(); dispatch_semaphore_signal(delayedProcessingSemaphore); }); - dispatch_semaphore_wait(delayedProcessingSemaphore, dispatch_time(DISPATCH_TIME_NOW, timeout * NSEC_PER_SEC)); + dispatch_semaphore_wait(delayedProcessingSemaphore, dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeout * NSEC_PER_SEC))); } @end diff --git a/AppCenter/AppCenterTests/MSUtilityTests.m b/AppCenter/AppCenterTests/MSUtilityTests.m index 68491acd8c..ede906b339 100644 --- a/AppCenter/AppCenterTests/MSUtilityTests.m +++ b/AppCenter/AppCenterTests/MSUtilityTests.m @@ -1014,6 +1014,53 @@ - (void)testPerformBlockOnMainThread { }]; } +- (void)testDispatchSyncWithTimeoutDoesNotWait { + + // If + XCTestExpectation *expectation = [self expectationWithDescription:@"block not called."]; + [expectation setInverted:YES]; + dispatch_queue_t serialQueue = dispatch_queue_create("test", DISPATCH_QUEUE_SERIAL); + + // When + [MSDispatcherUtil dispatchSyncWithTimeout:1 + onQueue:serialQueue + withBlock:^{ + [NSThread sleepForTimeInterval:4.000]; + [expectation fulfill]; + }]; + + // Then + [self waitForExpectationsWithTimeout:kMSTestTimeout + handler:^(NSError *error) { + if (error) { + XCTFail(@"Expectation Failed with error: %@", error); + } + }]; +} + +- (void)testDispatchSyncWithTimeoutWaitsForBlock { + + // If + XCTestExpectation *expectation = [self expectationWithDescription:@"block called."]; + dispatch_queue_t serialQueue = dispatch_queue_create("test", DISPATCH_QUEUE_SERIAL); + + // When + [MSDispatcherUtil dispatchSyncWithTimeout:3 + onQueue:serialQueue + withBlock:^{ + [NSThread sleepForTimeInterval:2.000]; + [expectation fulfill]; + }]; + + // Then + [self waitForExpectationsWithTimeout:kMSTestTimeout + handler:^(NSError *error) { + if (error) { + XCTFail(@"Expectation Failed with error: %@", error); + } + }]; +} + - (void)testPerformBlockOnMainThreadFromBackground { // If From f04f0545777e0275779352930ffcf39841eb61bb Mon Sep 17 00:00:00 2001 From: Anna Kocheshkova Date: Mon, 17 Aug 2020 12:33:22 +0300 Subject: [PATCH 30/34] Make timeout smaller --- .../AppCenter/Internals/Util/MSDispatcherUtil.h | 2 +- .../AppCenter/Internals/Util/MSDispatcherUtil.m | 2 +- AppCenter/AppCenterTests/MSUtilityTests.m | 14 ++++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h index 2cba15afcc..90a39e87a4 100644 --- a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h +++ b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h @@ -20,6 +20,6 @@ * @param dispatchQueue the queue to perform block on. * @param block the block to be executed. */ -+ (void)dispatchSyncWithTimeout:(float)timeout onQueue:(dispatch_queue_t)dispatchQueue withBlock:(dispatch_block_t)block; ++ (void)dispatchSyncWithTimeout:(NSTimeInterval)timeout onQueue:(dispatch_queue_t)dispatchQueue withBlock:(dispatch_block_t)block; @end diff --git a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m index ce543e24f1..b851ade5d3 100644 --- a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m +++ b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.m @@ -23,7 +23,7 @@ + (void)runBlock:(void (^)(void))block { block(); } -+ (void)dispatchSyncWithTimeout:(float)timeout onQueue:(dispatch_queue_t)dispatchQueue withBlock:(dispatch_block_t)block { ++ (void)dispatchSyncWithTimeout:(NSTimeInterval)timeout onQueue:(dispatch_queue_t)dispatchQueue withBlock:(dispatch_block_t)block { dispatch_semaphore_t delayedProcessingSemaphore = dispatch_semaphore_create(0); dispatch_async(dispatchQueue, ^{ block(); diff --git a/AppCenter/AppCenterTests/MSUtilityTests.m b/AppCenter/AppCenterTests/MSUtilityTests.m index ede906b339..17764025b8 100644 --- a/AppCenter/AppCenterTests/MSUtilityTests.m +++ b/AppCenter/AppCenterTests/MSUtilityTests.m @@ -1017,20 +1017,21 @@ - (void)testPerformBlockOnMainThread { - (void)testDispatchSyncWithTimeoutDoesNotWait { // If + NSTimeInterval blockTimeout = 0.1; XCTestExpectation *expectation = [self expectationWithDescription:@"block not called."]; [expectation setInverted:YES]; dispatch_queue_t serialQueue = dispatch_queue_create("test", DISPATCH_QUEUE_SERIAL); // When - [MSDispatcherUtil dispatchSyncWithTimeout:1 + [MSDispatcherUtil dispatchSyncWithTimeout:blockTimeout onQueue:serialQueue withBlock:^{ - [NSThread sleepForTimeInterval:4.000]; + [NSThread sleepForTimeInterval:blockTimeout * 2]; [expectation fulfill]; }]; // Then - [self waitForExpectationsWithTimeout:kMSTestTimeout + [self waitForExpectationsWithTimeout:0 handler:^(NSError *error) { if (error) { XCTFail(@"Expectation Failed with error: %@", error); @@ -1041,19 +1042,20 @@ - (void)testDispatchSyncWithTimeoutDoesNotWait { - (void)testDispatchSyncWithTimeoutWaitsForBlock { // If + NSTimeInterval blockTimeout = 0.5; XCTestExpectation *expectation = [self expectationWithDescription:@"block called."]; dispatch_queue_t serialQueue = dispatch_queue_create("test", DISPATCH_QUEUE_SERIAL); // When - [MSDispatcherUtil dispatchSyncWithTimeout:3 + [MSDispatcherUtil dispatchSyncWithTimeout:blockTimeout onQueue:serialQueue withBlock:^{ - [NSThread sleepForTimeInterval:2.000]; + [NSThread sleepForTimeInterval:blockTimeout / 2]; [expectation fulfill]; }]; // Then - [self waitForExpectationsWithTimeout:kMSTestTimeout + [self waitForExpectationsWithTimeout:0 handler:^(NSError *error) { if (error) { XCTFail(@"Expectation Failed with error: %@", error); From 7185a193805d5d19c822732749f49c2c1b4985e9 Mon Sep 17 00:00:00 2001 From: Anna Kocheshkova Date: Mon, 17 Aug 2020 22:12:01 +0300 Subject: [PATCH 31/34] Apply suggestions from code review Co-authored-by: Clement Polet --- AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h | 6 +++--- CHANGELOG.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h index 90a39e87a4..4399d17800 100644 --- a/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h +++ b/AppCenter/AppCenter/Internals/Util/MSDispatcherUtil.h @@ -16,9 +16,9 @@ /** * Adds a dispatch_async block to the provided queue and waits for its execution. - * @param timeout timeout for waiting in seconds. - * @param dispatchQueue the queue to perform block on. - * @param block the block to be executed. + * @param timeout Timeout for waiting in seconds. + * @param dispatchQueue The queue to perform a block on. + * @param block The block to be executed. */ + (void)dispatchSyncWithTimeout:(NSTimeInterval)timeout onQueue:(dispatch_queue_t)dispatchQueue withBlock:(dispatch_block_t)block; diff --git a/CHANGELOG.md b/CHANGELOG.md index 0455282854..55db9a068e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ ### App Center Analytics -* **[Fix]** Fix sending logs from `applicationWillTerminate`. +* **[Fix]** Fix processing logs (e.g., events) emitted from the `applicationWillTerminate` application delegate method. ___ From 0d0b93190ca950fa16a479360d87fa55ed9d1acc Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Wed, 19 Aug 2020 12:15:00 +0300 Subject: [PATCH 32/34] Update PLCrashReporter to 1.7.2 --- Package.swift | 3 +-- Vendor/PLCrashReporter | 2 +- cgmanifest.json | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Package.swift b/Package.swift index 99a3c4090c..2bf2d11419 100644 --- a/Package.swift +++ b/Package.swift @@ -23,8 +23,7 @@ let package = Package( targets: ["AppCenterCrashes"]) ], dependencies: [ - // TODO replace commit hash to released version before release. - .package(url: "https://github.com/microsoft/plcrashreporter.git", .revision("ec31c6c3017854c57736bac2b0d174eecef920cb")), + .package(url: "https://github.com/microsoft/plcrashreporter.git", .upToNextMinor(from: "1.7.2")), ], targets: [ .target( diff --git a/Vendor/PLCrashReporter b/Vendor/PLCrashReporter index ec31c6c301..259ca8bafb 160000 --- a/Vendor/PLCrashReporter +++ b/Vendor/PLCrashReporter @@ -1 +1 @@ -Subproject commit ec31c6c3017854c57736bac2b0d174eecef920cb +Subproject commit 259ca8bafb1ea65426ab9616f51e0d3565e46720 diff --git a/cgmanifest.json b/cgmanifest.json index b638b36b67..8e27e1503d 100644 --- a/cgmanifest.json +++ b/cgmanifest.json @@ -6,7 +6,7 @@ "git": { "name": "PLCrashReporter", "repositoryUrl": "https://github.com/microsoft/plcrashreporter.git", - "commitHash": "ec31c6c3017854c57736bac2b0d174eecef920cb" + "commitHash": "259ca8bafb1ea65426ab9616f51e0d3565e46720" } } }, From 0f5722c77928465371d4fef5d3ddeb9c3d58da15 Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Wed, 19 Aug 2020 12:15:44 +0300 Subject: [PATCH 33/34] Update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55db9a068e..db7364c7f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ * **[Fix]** Fix processing logs (e.g., events) emitted from the `applicationWillTerminate` application delegate method. +### App Center Crashes + +* **[Improvement]** Update PLCrashReporter to 1.7.2. + ___ ## Version 3.3.2 From 7300a1b72190f6eac7b2276715ac65939185fddf Mon Sep 17 00:00:00 2001 From: beyondsoft_imac Date: Thu, 20 Aug 2020 10:23:02 +0800 Subject: [PATCH 34/34] update versions for release 3.3.3 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55db9a068e..00c2a775c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # App Center SDK for iOS, macOS and tvOS Change Log -## Version 3.3.3 (Under development) +## Version 3.3.3 ### App Center