From 742d2ccc63654e665b25eaa6a1dca6be74e1bee0 Mon Sep 17 00:00:00 2001 From: Roman Podymov Date: Sun, 2 Jun 2024 02:31:21 +0200 Subject: [PATCH 1/5] Update from master (#6) --- .github/workflows/ci-podspec.yml | 8 +++- .github/workflows/ci.yml | 34 +++-------------- Package@swift-5.3.swift | 3 ++ PromiseKit.podspec | 9 ++++- PromiseKit.xcodeproj/project.pbxproj | 27 +++++++++++-- Sources/Async.swift | 2 +- Sources/Resources/PrivacyInfo.xcprivacy | 8 ++++ Tests/CorePromise/AsyncTests.swift | 50 +++++++++++++++++++++++++ tea.yaml | 7 ++++ 9 files changed, 111 insertions(+), 37 deletions(-) create mode 100644 Sources/Resources/PrivacyInfo.xcprivacy create mode 100644 tea.yaml diff --git a/.github/workflows/ci-podspec.yml b/.github/workflows/ci-podspec.yml index 8906b016c..df559f69c 100644 --- a/.github/workflows/ci-podspec.yml +++ b/.github/workflows/ci-podspec.yml @@ -5,8 +5,14 @@ on: - PromiseKit.podspec jobs: lint: - runs-on: macos-latest + runs-on: macos-14 steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: 15.2 + - uses: maxim-lobanov/setup-cocoapods@v1 + with: + version: 1.15.0 - uses: actions/checkout@v2 with: submodules: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71262b25a..d49c258c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,17 +75,17 @@ jobs: - run: git diff --exit-code test: - runs-on: macos-latest + runs-on: macos-14 strategy: matrix: dst: - - platform=macOS - - platform=tvOS Simulator,OS=15.0,name=Apple TV - - platform=iOS Simulator,OS=15.0,name=iPhone 12 + - "platform=macOS,arch=arm64,id=0000FE00-392BB8A41C01F642" + - "platform=iOS Simulator,OS=17.0.1,name=iPhone 14" + - "platform=tvOS Simulator,OS=17.2,name=Apple TV" steps: - uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: 13.1 + xcode-version: 15.2 - uses: actions/checkout@v2 - uses: sersoft-gmbh/xcodebuild-action@v1 with: @@ -95,27 +95,3 @@ jobs: action: test enable-code-coverage: true - uses: codecov/codecov-action@v1 - - carthage: - runs-on: ${{ matrix.macos }} - strategy: - matrix: - xcode: [^11, ^12, ^13] - macos: [macos-11] - steps: - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: ${{ matrix.xcode }} - - uses: actions/checkout@v2 - - - uses: mingjun97/file-regex-replace@v1 - with: - regex: SWIFT_TREAT_WARNINGS_AS_ERRORS = NO - replacement: SWIFT_TREAT_WARNINGS_AS_ERRORS = YES - include: project.pbxproj - - - run: | - if [ ${{ matrix.xcode }} != ^11 ]; then - echo "CARTHAGE_ARGS=--use-xcframeworks" >> $GITHUB_ENV - fi - - run: carthage build --no-skip-current --no-use-binaries $CARTHAGE_ARGS diff --git a/Package@swift-5.3.swift b/Package@swift-5.3.swift index 0c4bf4d24..5d5bac30d 100644 --- a/Package@swift-5.3.swift +++ b/Package@swift-5.3.swift @@ -12,6 +12,9 @@ pkg.products = [ let pmk: Target = .target(name: "PromiseKit") pmk.path = "Sources" +pmk.resources = [ + .process("Resources/PrivacyInfo.xcprivacy") +] pmk.exclude = [ "AnyPromise.swift", "AnyPromise.m", diff --git a/PromiseKit.podspec b/PromiseKit.podspec index a4a0f26fa..af13d0b3e 100644 --- a/PromiseKit.podspec +++ b/PromiseKit.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "PromiseKit" - s.version = '8.1.1' + s.version = '8.1.2' s.source = { :git => "https://github.com/mxcl/#{s.name}.git", @@ -19,7 +19,7 @@ Pod::Spec.new do |s| s.default_subspecs = 'CorePromise', 'UIKit', 'Foundation' s.requires_arc = true - s.swift_versions = ['3.2', '3.3', '3.4', '4.0', '4.1', '4.2', '4.3', '4.4', '5.0', '5.1', '5.2', '5.3', '5.4', '5.5'] + s.swift_version = '3.2', '3.3', '3.4', '4.0', '4.1', '4.2', '4.3', '4.4', '5.0', '5.1', '5.2', '5.3', '5.4', '5.5' # CocoaPods requires us to specify the root deployment targets # even though for us it is nonsense. Our root spec has no @@ -28,11 +28,16 @@ Pod::Spec.new do |s| s.osx.deployment_target = '10.13' s.watchos.deployment_target = '4.0' s.tvos.deployment_target = '10.0' + s.visionos.deployment_target = '1.0' s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-DPMKCocoaPods', } + s.resource_bundles = { + 'SwifterSwift_Privacy' => 'Sources/Resources/PrivacyInfo.xcprivacy' + } + s.subspec 'Accounts' do |ss| ss.ios.source_files = ss.osx.source_files = 'Extensions/Accounts/Sources/**/*' ss.exclude_files = 'Extensions/Accounts/Sources/*.plist' diff --git a/PromiseKit.xcodeproj/project.pbxproj b/PromiseKit.xcodeproj/project.pbxproj index 6361b1800..c9097ef1e 100644 --- a/PromiseKit.xcodeproj/project.pbxproj +++ b/PromiseKit.xcodeproj/project.pbxproj @@ -231,6 +231,7 @@ 9E4170F8287D88C800A3B4B5 /* Async.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Async.swift; path = Sources/Async.swift; sourceTree = ""; }; 9E4170FA287D8DBD00A3B4B5 /* AsyncTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AsyncTests.swift; sourceTree = ""; }; 9E66231526FE5A8C00FA25CB /* RaceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RaceTests.m; sourceTree = ""; }; + 9E8028F72BDCEDBC0081E2D1 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; 9EC774262991495C00803027 /* Combine.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Combine.swift; path = Sources/Combine.swift; sourceTree = ""; }; 9EC774282991497900803027 /* CombineTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CombineTests.swift; sourceTree = ""; }; C013F7372048E3B6006B57B1 /* MockNodeEnvironment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MockNodeEnvironment.swift; path = "Tests/JS-A+/MockNodeEnvironment.swift"; sourceTree = ""; }; @@ -458,6 +459,7 @@ 63B18AEB1F2D205C00B79E37 /* CustomStringConvertible.swift */, 63D9B2F020338D5D0075C00B /* Deprecations.swift */, 085B96BE21A9B37C00E5E22F /* LogEvent.swift */, + 9E8028F82BDCEDBC0081E2D1 /* Resources */, ); name = Sources.swift; sourceTree = ""; @@ -497,6 +499,15 @@ name = Features; sourceTree = ""; }; + 9E8028F82BDCEDBC0081E2D1 /* Resources */ = { + isa = PBXGroup; + children = ( + 9E8028F72BDCEDBC0081E2D1 /* PrivacyInfo.xcprivacy */, + ); + name = Resources; + path = Sources/Resources; + sourceTree = ""; + }; C0244E6B2047ACAF00ACB4AC /* JS/A+ */ = { isa = PBXGroup; children = ( @@ -946,7 +957,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 8.1.1; + CURRENT_PROJECT_VERSION = 8.1.2; DEBUG_INFORMATION_FORMAT = dwarf; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -976,6 +987,7 @@ TVOS_DEPLOYMENT_TARGET = 11.0; VERSIONING_SYSTEM = "apple-generic"; WATCHOS_DEPLOYMENT_TARGET = 4.0; + XROS_DEPLOYMENT_TARGET = 1.0; }; name = Debug; }; @@ -1008,7 +1020,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 8.1.1; + CURRENT_PROJECT_VERSION = 8.1.2; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -1034,6 +1046,7 @@ TVOS_DEPLOYMENT_TARGET = 11.0; VERSIONING_SYSTEM = "apple-generic"; WATCHOS_DEPLOYMENT_TARGET = 4.0; + XROS_DEPLOYMENT_TARGET = 1.0; }; name = Release; }; @@ -1087,8 +1100,11 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_PACKAGE_TYPE = FMWK; SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "$(AVAILABLE_PLATFORMS)"; + SUPPORTS_MACCATALYST = YES; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES; SWIFT_TREAT_WARNINGS_AS_ERRORS = NO; - TARGETED_DEVICE_FAMILY = "1,2,3,4"; + TARGETED_DEVICE_FAMILY = "1,2,3,4,6,7"; }; name = Debug; }; @@ -1142,8 +1158,11 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_PACKAGE_TYPE = FMWK; SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "$(AVAILABLE_PLATFORMS)"; + SUPPORTS_MACCATALYST = YES; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES; SWIFT_TREAT_WARNINGS_AS_ERRORS = NO; - TARGETED_DEVICE_FAMILY = "1,2,3,4"; + TARGETED_DEVICE_FAMILY = "1,2,3,4,6,7"; }; name = Release; }; diff --git a/Sources/Async.swift b/Sources/Async.swift index dbfc34457..b4b672c4c 100644 --- a/Sources/Async.swift +++ b/Sources/Async.swift @@ -17,7 +17,7 @@ public extension Promise { try await withCheckedThrowingContinuation { continuation in done { value in continuation.resume(returning: value) - }.catch { error in + }.catch(policy: .allErrors) { error in continuation.resume(throwing: error) } } diff --git a/Sources/Resources/PrivacyInfo.xcprivacy b/Sources/Resources/PrivacyInfo.xcprivacy new file mode 100644 index 000000000..cfbe279c7 --- /dev/null +++ b/Sources/Resources/PrivacyInfo.xcprivacy @@ -0,0 +1,8 @@ + + + + + NSPrivacyTracking + + + diff --git a/Tests/CorePromise/AsyncTests.swift b/Tests/CorePromise/AsyncTests.swift index fa1dd61ac..345c5e32e 100644 --- a/Tests/CorePromise/AsyncTests.swift +++ b/Tests/CorePromise/AsyncTests.swift @@ -94,5 +94,55 @@ class AsyncTests: XCTestCase { } #endif + + #if swift(>=5.5) + #if canImport(_Concurrency) + @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) + func testAsyncPromiseCancel() async throws { + do { + let p = after(seconds: 0).done { _ in + throw LocalError.cancel + }.done { + XCTFail() + } + p.catch { _ in + XCTFail() + } + try await p.async() + XCTAssert(false) + } catch { + guard let cancellableError = error as? CancellableError else { return XCTFail("Unexpected error type") } + XCTAssertTrue(cancellableError.isCancelled) + } + } + + @available(iOS, deprecated: 13.0) + @available(macOS, deprecated: 10.15) + @available(tvOS, deprecated: 13.0) + @available(watchOS, deprecated: 6.0) + func testAsyncPromiseCancel() { + + } + #else + func testAsyncPromiseCancel() { + + } + #endif + #else + func testAsyncPromiseCancel() { + + } + #endif } +private enum LocalError: CancellableError { + case notCancel + case cancel + + var isCancelled: Bool { + switch self { + case .notCancel: return false + case .cancel: return true + } + } +} diff --git a/tea.yaml b/tea.yaml new file mode 100644 index 000000000..404b0956e --- /dev/null +++ b/tea.yaml @@ -0,0 +1,7 @@ +# https://tea.xyz/what-is-this-file +# created with https://mash.pkgx.sh/mxcl/tea-register +--- +version: 1.0.0 +codeOwners: + - '0x5E2DE4A68df811AAAD32d71fb065e6946fA5C8d9' # mxcl +quorum: 1 From d68b04cc63b2c650210764b6d81dfd643695ebf7 Mon Sep 17 00:00:00 2001 From: Roman Podymov Date: Sun, 2 Jun 2024 02:32:25 +0200 Subject: [PATCH 2/5] Update publish.yml --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fb097272f..a3b3f1709 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,8 +20,8 @@ jobs: strategy: matrix: xcode: - - ^13 - ^14 + - ^15 steps: - uses: maxim-lobanov/setup-xcode@v1 with: From 8b7d8c7683247c5d145cb448eb152213d5ec9616 Mon Sep 17 00:00:00 2001 From: Roman Podymov Date: Sun, 2 Jun 2024 02:38:38 +0200 Subject: [PATCH 3/5] Update publish.yml --- .github/workflows/publish.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a3b3f1709..0e14a548a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,7 +20,6 @@ jobs: strategy: matrix: xcode: - - ^14 - ^15 steps: - uses: maxim-lobanov/setup-xcode@v1 From 8e519d6f38a1ebcf52d6eaec0dff63b3209ad84d Mon Sep 17 00:00:00 2001 From: Roman Podymov Date: Sun, 2 Jun 2024 16:14:14 +0200 Subject: [PATCH 4/5] Tests --- Tests/CorePromise/XCTestManifests.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Tests/CorePromise/XCTestManifests.swift b/Tests/CorePromise/XCTestManifests.swift index 21dc7b5f3..df9aba882 100644 --- a/Tests/CorePromise/XCTestManifests.swift +++ b/Tests/CorePromise/XCTestManifests.swift @@ -19,6 +19,8 @@ extension AsyncTests { static let __allTests__AsyncTests = [ ("testAsyncGuaranteeValue", testAsyncGuaranteeValue), ("testAsyncGuaranteeValue", testAsyncGuaranteeValue), + ("testAsyncPromiseCancel", testAsyncPromiseCancel), + ("testAsyncPromiseCancel", testAsyncPromiseCancel), ("testAsyncPromiseThrow", testAsyncPromiseThrow), ("testAsyncPromiseThrow", testAsyncPromiseThrow), ("testAsyncPromiseValue", testAsyncPromiseValue), From dad03319492974c3509670a6444d16517ecbb765 Mon Sep 17 00:00:00 2001 From: Roman Podymov Date: Sun, 2 Jun 2024 16:37:25 +0200 Subject: [PATCH 5/5] Update from master (#7)