From d7ee3951a2dc6b585fbf8bc3f18839a54f1f763d Mon Sep 17 00:00:00 2001 From: dive Date: Sun, 22 Mar 2020 22:50:07 +0000 Subject: [PATCH 01/11] modified flaky unit-test --- MobileOrgTests/OrgfileParserTests.swift | 81 +++++++++++++------------ 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/MobileOrgTests/OrgfileParserTests.swift b/MobileOrgTests/OrgfileParserTests.swift index 6ae72c4..27bd7ac 100644 --- a/MobileOrgTests/OrgfileParserTests.swift +++ b/MobileOrgTests/OrgfileParserTests.swift @@ -66,47 +66,50 @@ class OrgfileParserTests: XCTestCase { // Parse OrgFiles for todo-keywords of different kind - func testParseOrgFileDifferentTodoWords() { - let parser = OrgFileParser() - - let bundle = Bundle(for: type(of: self)) - - // Parse the index file (here are the todo keywords stored for processing) - let indexUrl = bundle.url(forResource: "index", withExtension: "org") - parser.localFilename = indexUrl?.relativePath - parser.orgFilename = "index.org" - parser.parse(moc) - - // now parse the todo list - let url = bundle.url(forResource: "TodoList", withExtension: "org") - parser.localFilename = url?.relativePath - parser.orgFilename = "TodoList.org" - parser.parse(moc) + func testParseOrgFileDifferentTodoWords() throws { + guard let capturedMOC = moc else { + XCTFail("MOC is nil") + return + } - do { - // Test todo state (waiting) - let fetchRequest = NSFetchRequest(entityName: "Node") - fetchRequest.predicate = NSPredicate (format: "heading == %@", "on Level 1.1.1.5") - - var nodes = try moc!.fetch(fetchRequest) - if nodes.count == 1, - let node = nodes.first { - XCTAssertEqual(node.todoState, "WAITING") - } else { - XCTFail() - } + let parser = OrgFileParser() + let bundle = Bundle(for: type(of: self)) + + // Parse the index file (here are the todo keywords stored for processing) + let indexUrl = bundle.url(forResource: "index", withExtension: "org") + parser.localFilename = indexUrl?.relativePath + parser.orgFilename = "index.org" + parser.parse(capturedMOC) + + // now parse the todo list + let url = bundle.url(forResource: "TodoList", withExtension: "org") + parser.localFilename = url?.relativePath + parser.orgFilename = "TodoList.org" + parser.parse(capturedMOC) + + XCTAssertNoThrow(try capturedMOC.save()) + capturedMOC.processPendingChanges() + + do { + // Test todo state (waiting) + let fetchRequest = NSFetchRequest(entityName: "Node") + fetchRequest.predicate = NSPredicate (format: "heading == %@", "on Level 1.1.1.5") + + if let firstNode = try capturedMOC.fetch(fetchRequest).first { + XCTAssertEqual(firstNode.todoState, "WAITING") + } else { + XCTFail("Cannot fetch a proper node") + } - // Test done state (works for me) - fetchRequest.predicate = NSPredicate (format: "heading == %@", "on Level 1.1.1.3") - nodes = try moc!.fetch(fetchRequest) - if nodes.count == 1, - let node = nodes.first { - XCTAssertEqual(node.todoState, "WORKS-FOR-ME") - } else { - XCTFail() - } - } catch _ { XCTFail() } - } + // Test done state (works for me) + fetchRequest.predicate = NSPredicate (format: "heading == %@", "on Level 1.1.1.3") + if let firstNode = try capturedMOC.fetch(fetchRequest).first { + XCTAssertEqual(firstNode.todoState, "WORKS-FOR-ME") + } else { + XCTFail("Cannot fetch a proper node") + } + } catch _ { XCTFail() } + } // Tackles bug described in: From 7b8953596b8232ca2c04d4f149373c1634f98a85 Mon Sep 17 00:00:00 2001 From: dive Date: Sun, 22 Mar 2020 22:50:18 +0000 Subject: [PATCH 02/11] switched to random execution for unit-tests --- MobileOrg.xcodeproj/xcshareddata/xcschemes/MobileOrg.xcscheme | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MobileOrg.xcodeproj/xcshareddata/xcschemes/MobileOrg.xcscheme b/MobileOrg.xcodeproj/xcshareddata/xcschemes/MobileOrg.xcscheme index 68332f3..df10ad2 100644 --- a/MobileOrg.xcodeproj/xcshareddata/xcschemes/MobileOrg.xcscheme +++ b/MobileOrg.xcodeproj/xcshareddata/xcschemes/MobileOrg.xcscheme @@ -38,7 +38,8 @@ + skipped = "NO" + testExecutionOrdering = "random"> Date: Sat, 3 Oct 2020 11:46:55 +0100 Subject: [PATCH 03/11] Removed Carthage support --- Cartfile | 1 - Cartfile.resolved | 2 -- Configuration/Carthage-in.xcfilelist | 2 -- Configuration/Carthage-out.xcfilelist | 2 -- Global.shared.xcconfig | 2 +- MobileOrg.xcodeproj/project.pbxproj | 35 +-------------------------- 6 files changed, 2 insertions(+), 42 deletions(-) delete mode 100644 Cartfile delete mode 100644 Cartfile.resolved delete mode 100644 Configuration/Carthage-in.xcfilelist delete mode 100644 Configuration/Carthage-out.xcfilelist diff --git a/Cartfile b/Cartfile deleted file mode 100644 index 81cc793..0000000 --- a/Cartfile +++ /dev/null @@ -1 +0,0 @@ -github "https://github.com/dropbox/SwiftyDropbox" ~> 5.1.0 diff --git a/Cartfile.resolved b/Cartfile.resolved deleted file mode 100644 index 7d6f16e..0000000 --- a/Cartfile.resolved +++ /dev/null @@ -1,2 +0,0 @@ -github "Alamofire/Alamofire" "4.9.1" -github "dropbox/SwiftyDropbox" "5.1.0" diff --git a/Configuration/Carthage-in.xcfilelist b/Configuration/Carthage-in.xcfilelist deleted file mode 100644 index a664c17..0000000 --- a/Configuration/Carthage-in.xcfilelist +++ /dev/null @@ -1,2 +0,0 @@ -$(SRCROOT)/Carthage/Build/iOS/SwiftyDropbox.framework -$(SRCROOT)/Carthage/Build/iOS/Alamofire.framework diff --git a/Configuration/Carthage-out.xcfilelist b/Configuration/Carthage-out.xcfilelist deleted file mode 100644 index 99b37fd..0000000 --- a/Configuration/Carthage-out.xcfilelist +++ /dev/null @@ -1,2 +0,0 @@ -$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/SwiftyDropbox.framework -$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Alamofire.framework diff --git a/Global.shared.xcconfig b/Global.shared.xcconfig index aa73cdc..89dc0a8 100644 --- a/Global.shared.xcconfig +++ b/Global.shared.xcconfig @@ -15,7 +15,7 @@ ALWAYS_SEARCH_USER_PATHS = NO CLANG_ANALYZER_NONNULL = YES CLANG_ENABLE_MODULES = YES CLANG_ENABLE_OBJC_ARC = YES -FRAMEWORK_SEARCH_PATHS = $(inherited) $(SRCROOT) $(PROJECT_DIR) $(PROJECT_DIR)/Carthage/Build/iOS +FRAMEWORK_SEARCH_PATHS = $(inherited) $(SRCROOT) $(PROJECT_DIR) GCC_NO_COMMON_BLOCKS = YES GCC_PRECOMPILE_PREFIX_HEADER = YES IPHONEOS_DEPLOYMENT_TARGET = 12.0 diff --git a/MobileOrg.xcodeproj/project.pbxproj b/MobileOrg.xcodeproj/project.pbxproj index 9b727c2..561a919 100644 --- a/MobileOrg.xcodeproj/project.pbxproj +++ b/MobileOrg.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 48; objects = { /* Begin PBXBuildFile section */ @@ -11,7 +11,6 @@ 18A3BBA716178DCD003D9320 /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 18A3BBA616178DCD003D9320 /* Reachability.m */; }; 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; - 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; 28D801B40F44B63D00FB423F /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28D801B30F44B63D00FB423F /* CoreData.framework */; }; @@ -122,8 +121,6 @@ 8322ED8B176AF1C7008B37C7 /* settings@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8322ED85176AF1C4008B37C7 /* settings@2x.png */; }; 8322ED8C176AF1C7008B37C7 /* table_gray@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8322ED86176AF1C6008B37C7 /* table_gray@2x.png */; }; 83B1312C234AD16D0043D955 /* CloudKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83B1312B234AD16D0043D955 /* CloudKit.framework */; }; - CE67A65B23A5CDD900B2B0BD /* SwiftyDropbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE67A65923A5CB6500B2B0BD /* SwiftyDropbox.framework */; }; - CE67A65F23A5CE1800B2B0BD /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE67A65E23A5CE1800B2B0BD /* Alamofire.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -142,7 +139,6 @@ 18A3BBA616178DCD003D9320 /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Reachability.m; sourceTree = ""; }; 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 1D6058910D05DD3D006BFB54 /* MobileOrg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MobileOrg.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; 28D801B30F44B63D00FB423F /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; @@ -294,8 +290,6 @@ 8322ED86176AF1C6008B37C7 /* table_gray@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "table_gray@2x.png"; sourceTree = ""; }; 83B1312B234AD16D0043D955 /* CloudKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CloudKit.framework; path = System/Library/Frameworks/CloudKit.framework; sourceTree = SDKROOT; }; 83BCC85D203E92C700064F22 /* MobileOrg.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = MobileOrg.entitlements; path = MobileOrg/MobileOrg.entitlements; sourceTree = ""; }; - CE67A65923A5CB6500B2B0BD /* SwiftyDropbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftyDropbox.framework; path = Carthage/Build/iOS/SwiftyDropbox.framework; sourceTree = ""; }; - CE67A65E23A5CE1800B2B0BD /* Alamofire.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Alamofire.framework; path = Carthage/Build/iOS/Alamofire.framework; sourceTree = ""; }; CECD59F423B8D6C200348D89 /* MobileOrgTests-AppStore.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "MobileOrgTests-AppStore.xcconfig"; path = "Configuration/MobileOrgTests-AppStore.xcconfig"; sourceTree = ""; }; CECD59F523B8D6C200348D89 /* MobileOrg-AdHoc.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "MobileOrg-AdHoc.xcconfig"; path = "Configuration/MobileOrg-AdHoc.xcconfig"; sourceTree = ""; }; CECD59F623B8D6C200348D89 /* MobileOrgTests-Shared.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "MobileOrgTests-Shared.xcconfig"; path = "Configuration/MobileOrgTests-Shared.xcconfig"; sourceTree = ""; }; @@ -312,12 +306,9 @@ buildActionMask = 2147483647; files = ( 747BF9811DFCBC3F00E800FB /* libicucore.tbd in Frameworks */, - CE67A65B23A5CDD900B2B0BD /* SwiftyDropbox.framework in Frameworks */, 18A3BBA316178BDD003D9320 /* QuartzCore.framework in Frameworks */, 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, - 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, - CE67A65F23A5CE1800B2B0BD /* Alamofire.framework in Frameworks */, 83B1312C234AD16D0043D955 /* CloudKit.framework in Frameworks */, 28D801B40F44B63D00FB423F /* CoreData.framework in Frameworks */, 793F7F6C107CB5FC00674D0A /* SystemConfiguration.framework in Frameworks */, @@ -400,14 +391,11 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( - CE67A65E23A5CE1800B2B0BD /* Alamofire.framework */, - CE67A65923A5CB6500B2B0BD /* SwiftyDropbox.framework */, 83B1312B234AD16D0043D955 /* CloudKit.framework */, 747BF9801DFCBC3F00E800FB /* libicucore.tbd */, 18A3BBA216178BDD003D9320 /* QuartzCore.framework */, 7945F61111A807FD00731598 /* Security.framework */, 793F7F6B107CB5FC00674D0A /* SystemConfiguration.framework */, - 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, 1D30AB110D05D00D00671497 /* Foundation.framework */, 288765A40DF7441C002DB57D /* CoreGraphics.framework */, 28D801B30F44B63D00FB423F /* CoreData.framework */, @@ -763,7 +751,6 @@ 83E77D421E2727790049AB02 /* Update Bundle Version Script */, 1D60588E0D05DD3D006BFB54 /* Sources */, 1D60588F0D05DD3D006BFB54 /* Frameworks */, - CEE3E41823C5E55C004648D1 /* Copy Carthage Frameworks Script */, ); buildRules = ( ); @@ -941,26 +928,6 @@ shellPath = /bin/sh; shellScript = "git=`sh /etc/profile; which git`\nappBuild=`\"$git\" rev-list HEAD --count`\nif [ $CONFIGURATION = \"Debug\" ]; then\nbranchName=`\"$git\" rev-parse --abbrev-ref HEAD`\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $appBuild-$branchName\" \"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}\"\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $appBuild-$branchName\" \"${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}.dSYM/Contents/Info.plist\"\nelse\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $appBuild\" \"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}\"\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $appBuild\" \"${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}.dSYM/Contents/Info.plist\"\nfi\necho \"Incremented the build number ${TARGET_BUILD_DIR}/${INFOPLIST_PATH}\"\n"; }; - CEE3E41823C5E55C004648D1 /* Copy Carthage Frameworks Script */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "$(SRCROOT)/Configuration/Carthage-in.xcfilelist", - ); - inputPaths = ( - ); - name = "Copy Carthage Frameworks Script"; - outputFileListPaths = ( - "$(SRCROOT)/Configuration/Carthage-out.xcfilelist", - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "carthage copy-frameworks\n"; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ From 542179d019b0ddfff0a4544820bd40ead7dbc2de Mon Sep 17 00:00:00 2001 From: Artem Loenko Date: Sat, 3 Oct 2020 12:23:00 +0100 Subject: [PATCH 04/11] Switched to SPM based SwiftyDropbox package --- MobileOrg.xcodeproj/project.pbxproj | 29 ++++++++++++++++++- .../contents.xcworkspacedata | 2 +- .../xcshareddata/swiftpm/Package.resolved | 25 ++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 MobileOrg.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/MobileOrg.xcodeproj/project.pbxproj b/MobileOrg.xcodeproj/project.pbxproj index 561a919..b757ff4 100644 --- a/MobileOrg.xcodeproj/project.pbxproj +++ b/MobileOrg.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 48; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */ @@ -17,6 +17,7 @@ 5420E7C9234D15F20008ADAC /* CloudTransferManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5420E7C8234D15F20008ADAC /* CloudTransferManager.swift */; }; 5420E7CD234FB4150008ADAC /* UIAlertController+MobileOrg.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5420E7CC234FB4150008ADAC /* UIAlertController+MobileOrg.swift */; }; 5420E7D1234FC7AA0008ADAC /* CloudTransferManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5420E7D0234FC7AA0008ADAC /* CloudTransferManagerTests.swift */; }; + 5459EDBF25288F44001A77EA /* SwiftyDropbox in Frameworks */ = {isa = PBXBuildFile; productRef = 5459EDBE25288F44001A77EA /* SwiftyDropbox */; }; 549D4BC72417D27900039E1E /* PreviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 549D4BC62417D27900039E1E /* PreviewViewController.swift */; }; 54CD6301234BC02D00D485E1 /* UIColor+MobileOrg.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54CD6300234BC02D00D485E1 /* UIColor+MobileOrg.swift */; }; 54CD6303234BC9A200D485E1 /* RoundedLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54CD6302234BC9A200D485E1 /* RoundedLabel.swift */; }; @@ -310,6 +311,7 @@ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, 83B1312C234AD16D0043D955 /* CloudKit.framework in Frameworks */, + 5459EDBF25288F44001A77EA /* SwiftyDropbox in Frameworks */, 28D801B40F44B63D00FB423F /* CoreData.framework in Frameworks */, 793F7F6C107CB5FC00674D0A /* SystemConfiguration.framework in Frameworks */, 7945F61211A807FD00731598 /* Security.framework in Frameworks */, @@ -757,6 +759,9 @@ dependencies = ( ); name = MobileOrg; + packageProductDependencies = ( + 5459EDBE25288F44001A77EA /* SwiftyDropbox */, + ); productName = MobileOrg; productReference = 1D6058910D05DD3D006BFB54 /* MobileOrg.app */; productType = "com.apple.product-type.application"; @@ -819,6 +824,9 @@ Base, ); mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; + packageReferences = ( + 5459EDBD25288F44001A77EA /* XCRemoteSwiftPackageReference "SwiftyDropbox" */, + ); productRefGroup = 19C28FACFE9D520D11CA2CBB /* Products */; projectDirPath = ""; projectRoot = ""; @@ -1104,6 +1112,25 @@ }; /* End XCConfigurationList section */ +/* Begin XCRemoteSwiftPackageReference section */ + 5459EDBD25288F44001A77EA /* XCRemoteSwiftPackageReference "SwiftyDropbox" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/dropbox/SwiftyDropbox.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 6.0.3; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 5459EDBE25288F44001A77EA /* SwiftyDropbox */ = { + isa = XCSwiftPackageProductDependency; + package = 5459EDBD25288F44001A77EA /* XCRemoteSwiftPackageReference "SwiftyDropbox" */; + productName = SwiftyDropbox; + }; +/* End XCSwiftPackageProductDependency section */ + /* Begin XCVersionGroup section */ 745B1E2E1EC98C9B00D80421 /* MobileOrg2.xcdatamodeld */ = { isa = XCVersionGroup; diff --git a/MobileOrg.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/MobileOrg.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 859415a..919434a 100644 --- a/MobileOrg.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/MobileOrg.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/MobileOrg.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/MobileOrg.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..3258d2f --- /dev/null +++ b/MobileOrg.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,25 @@ +{ + "object": { + "pins": [ + { + "package": "Alamofire", + "repositoryURL": "https://github.com/Alamofire/Alamofire.git", + "state": { + "branch": null, + "revision": "75bba56748359f297a83f620d45f72cf4ebee4e7", + "version": "4.8.2" + } + }, + { + "package": "SwiftyDropbox", + "repositoryURL": "https://github.com/dropbox/SwiftyDropbox.git", + "state": { + "branch": null, + "revision": "1a99f77ae123722322af455cb71a96e72eb153e1", + "version": "6.0.3" + } + } + ] + }, + "version": 1 +} From 430a3e00f31aa7cd40d840c5a85d308310b74833 Mon Sep 17 00:00:00 2001 From: Artem Loenko Date: Sat, 3 Oct 2020 12:23:40 +0100 Subject: [PATCH 05/11] Adjusted Dropbox handler for the new function signature --- Classes/Sync/Dropbox/DropboxTransferManager.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Classes/Sync/Dropbox/DropboxTransferManager.swift b/Classes/Sync/Dropbox/DropboxTransferManager.swift index dc5b31e..908192f 100644 --- a/Classes/Sync/Dropbox/DropboxTransferManager.swift +++ b/Classes/Sync/Dropbox/DropboxTransferManager.swift @@ -75,12 +75,12 @@ import SwiftyDropbox /// Handle Dropbox Authorisation FLow - /// Triggerd by AppDelegate + /// Triggered by AppDelegate /// /// - Parameter url: URL used for Authorisation /// - Returns: always true 🙄 func handleAuthFlow(url: URL) -> Bool { - if let authResult = DropboxClientsManager.handleRedirectURL(url) { + DropboxClientsManager.handleRedirectURL(url, completion: { authResult in switch authResult { case .success: NotificationCenter.default.post(name: Notification.Name(rawValue: "dropboxloginsuccess"), object: nil) @@ -89,9 +89,11 @@ import SwiftyDropbox case .cancel: print("Authorization flow was manually cancelled by user!") case .error(_, let description): - print("Error: \(description)") + print("Error: \(description ?? "Unknown")") + case .none: + print("Unknown result.") } - } + }) return true } From 4de92a7605618303f13b5dc3096b3bf2ffb90e65 Mon Sep 17 00:00:00 2001 From: Artem Loenko Date: Sat, 3 Oct 2020 12:42:17 +0100 Subject: [PATCH 06/11] Updated Travis CI configuration --- .travis.yml | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 713a495..a1e40d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,30 +1,21 @@ # Travis os: osx -osx_image: xcode11.3 -language: objective-c +osx_image: xcode12 +language: swift branches: only: - develop -cache: - directories: - - Carthage - before_install: - - export IOS_SIMULATOR_DESTINATION="platform=iOS Simulator,name=iPhone 8,OS=13.3" - -install: -- brew install carthage || true -- brew outdated carthage || brew upgrade carthage -- travis_wait 20 carthage bootstrap --platform iOS --cache-builds + - export IOS_SIMULATOR_DESTINATION="platform=iOS Simulator,name=iPhone 8,OS=14" before_script: - set -o pipefail script: - - travis_retry xcodebuild test -scheme MobileOrg -destination "$IOS_SIMULATOR_DESTINATION" | xcpretty -c + - travis_retry xcodebuild clean test -scheme MobileOrg -destination "$IOS_SIMULATOR_DESTINATION" | xcpretty -c notifications: irc: From ac507e07c506215de44ac6325fb3b3252627a794 Mon Sep 17 00:00:00 2001 From: Artem Loenko Date: Sat, 3 Oct 2020 12:44:40 +0100 Subject: [PATCH 07/11] Updated README with a note that the project uses Swift Package Manager --- README.org | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.org b/README.org index 7ff0ef8..6815c49 100644 --- a/README.org +++ b/README.org @@ -50,13 +50,7 @@ Find the file AppKey.plist in the project and obtain the information you've received from Dropbox there. - MobileOrg uses Carthage. Install Carthage by following the - instructions [[https://github.com/Carthage/Carthage#installing-carthage][from here.]] - Install the needed dependencies by running - #+BEGIN_SRC shell - carthage bootstrap --platform ios - #+END_SRC - in your shell. + MobileOrg uses Swift Package Manager to resolve dependencies. *** WebDAV tests From b2fbf4ace6b9879f1081eb2f5cc7ac9fa6382a7d Mon Sep 17 00:00:00 2001 From: Artem Loenko Date: Sat, 3 Oct 2020 13:40:30 +0100 Subject: [PATCH 08/11] Updated README with Xcode 12 requirement --- README.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.org b/README.org index 6815c49..9298656 100644 --- a/README.org +++ b/README.org @@ -43,6 +43,8 @@ ** Setting up your environment + Xcode >=12 is required to build the project. + For the usage of the Dropbox API an application key is necessary. You can obtain it [[https://www.dropbox.com/developers/apps/create][from Dropbox.]] It is important to apply for keys of the *App Folder* type not the *Full Dropbox* type. From 34cdf30b76a033c0ffe514174f3282d5480aafa5 Mon Sep 17 00:00:00 2001 From: Artem Loenko Date: Sat, 3 Oct 2020 13:48:10 +0100 Subject: [PATCH 09/11] Revert "modified flaky unit-test" This reverts commit d7ee3951a2dc6b585fbf8bc3f18839a54f1f763d. --- MobileOrgTests/OrgfileParserTests.swift | 81 ++++++++++++------------- 1 file changed, 39 insertions(+), 42 deletions(-) diff --git a/MobileOrgTests/OrgfileParserTests.swift b/MobileOrgTests/OrgfileParserTests.swift index 27bd7ac..6ae72c4 100644 --- a/MobileOrgTests/OrgfileParserTests.swift +++ b/MobileOrgTests/OrgfileParserTests.swift @@ -66,50 +66,47 @@ class OrgfileParserTests: XCTestCase { // Parse OrgFiles for todo-keywords of different kind - func testParseOrgFileDifferentTodoWords() throws { - guard let capturedMOC = moc else { - XCTFail("MOC is nil") - return - } + func testParseOrgFileDifferentTodoWords() { + let parser = OrgFileParser() - let parser = OrgFileParser() - let bundle = Bundle(for: type(of: self)) - - // Parse the index file (here are the todo keywords stored for processing) - let indexUrl = bundle.url(forResource: "index", withExtension: "org") - parser.localFilename = indexUrl?.relativePath - parser.orgFilename = "index.org" - parser.parse(capturedMOC) - - // now parse the todo list - let url = bundle.url(forResource: "TodoList", withExtension: "org") - parser.localFilename = url?.relativePath - parser.orgFilename = "TodoList.org" - parser.parse(capturedMOC) - - XCTAssertNoThrow(try capturedMOC.save()) - capturedMOC.processPendingChanges() - - do { - // Test todo state (waiting) - let fetchRequest = NSFetchRequest(entityName: "Node") - fetchRequest.predicate = NSPredicate (format: "heading == %@", "on Level 1.1.1.5") - - if let firstNode = try capturedMOC.fetch(fetchRequest).first { - XCTAssertEqual(firstNode.todoState, "WAITING") - } else { - XCTFail("Cannot fetch a proper node") - } + let bundle = Bundle(for: type(of: self)) - // Test done state (works for me) - fetchRequest.predicate = NSPredicate (format: "heading == %@", "on Level 1.1.1.3") - if let firstNode = try capturedMOC.fetch(fetchRequest).first { - XCTAssertEqual(firstNode.todoState, "WORKS-FOR-ME") - } else { - XCTFail("Cannot fetch a proper node") - } - } catch _ { XCTFail() } - } + // Parse the index file (here are the todo keywords stored for processing) + let indexUrl = bundle.url(forResource: "index", withExtension: "org") + parser.localFilename = indexUrl?.relativePath + parser.orgFilename = "index.org" + parser.parse(moc) + + // now parse the todo list + let url = bundle.url(forResource: "TodoList", withExtension: "org") + parser.localFilename = url?.relativePath + parser.orgFilename = "TodoList.org" + parser.parse(moc) + + do { + // Test todo state (waiting) + let fetchRequest = NSFetchRequest(entityName: "Node") + fetchRequest.predicate = NSPredicate (format: "heading == %@", "on Level 1.1.1.5") + + var nodes = try moc!.fetch(fetchRequest) + if nodes.count == 1, + let node = nodes.first { + XCTAssertEqual(node.todoState, "WAITING") + } else { + XCTFail() + } + + // Test done state (works for me) + fetchRequest.predicate = NSPredicate (format: "heading == %@", "on Level 1.1.1.3") + nodes = try moc!.fetch(fetchRequest) + if nodes.count == 1, + let node = nodes.first { + XCTAssertEqual(node.todoState, "WORKS-FOR-ME") + } else { + XCTFail() + } + } catch _ { XCTFail() } + } // Tackles bug described in: From 62081ad9a626f17c9d285c2494ed2c15123898fb Mon Sep 17 00:00:00 2001 From: Artem Loenko Date: Sat, 3 Oct 2020 13:48:22 +0100 Subject: [PATCH 10/11] Revert "switched to random execution for unit-tests" This reverts commit 7b8953596b8232ca2c04d4f149373c1634f98a85. --- MobileOrg.xcodeproj/xcshareddata/xcschemes/MobileOrg.xcscheme | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MobileOrg.xcodeproj/xcshareddata/xcschemes/MobileOrg.xcscheme b/MobileOrg.xcodeproj/xcshareddata/xcschemes/MobileOrg.xcscheme index 099a9ec..27837b7 100644 --- a/MobileOrg.xcodeproj/xcshareddata/xcschemes/MobileOrg.xcscheme +++ b/MobileOrg.xcodeproj/xcshareddata/xcschemes/MobileOrg.xcscheme @@ -38,8 +38,7 @@ + skipped = "NO"> Date: Sat, 3 Oct 2020 13:57:14 +0100 Subject: [PATCH 11/11] Updated iOS simulator specification for Travis CI --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a1e40d1..961c0fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ branches: - develop before_install: - - export IOS_SIMULATOR_DESTINATION="platform=iOS Simulator,name=iPhone 8,OS=14" + - export IOS_SIMULATOR_DESTINATION="platform=iOS Simulator,name=iPhone 8,OS=14.0" before_script: - set -o pipefail