paypal / paypal-ios

One merchant integration point for all of PayPal's services
Apache License 2.0
59 stars 27 forks source link

Bump to Xcode 14.3 and swift 5.8 #198

Closed KunJeongPark closed 1 year ago

KunJeongPark commented 1 year ago

Summary of changes

Checklist

Authors

KunJeongPark commented 1 year ago

Can't figure out why Build/Swift Package Manager is failing. This is the step where the SPMTest Xcode project tries to get PayPal package with native checkout dependency.

This is the error I see:

 xcodebuild: error: Could not resolve package dependencies:
  product 'PayPalCheckout' required by package 'paypal-ios' target 'PayPalNativePayments' not found.

=> So far, I've found correcting capitalization in build.yml file and using macOS-13 instead of macOS-latest with Swift version 5.7 passed the pipeline. I don't know why bumping the version to 5.8 causes error, same one above.

If I specify Swift 5.8 I get the output below before the error: Run xcodebuild -project 'SampleApps/SPMTest/SPMTest.xcodeproj' -scheme 'SPMTest' clean build archive CODE_SIGNING_ALLOWED=NO 2023-09-15 16:09:50.319 xcodebuild[2050:10546] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled) Command line invocation: /Applications/Xcode_14.3.1.app/Contents/Developer/usr/bin/xcodebuild -project SampleApps/SPMTest/SPMTest.xcodeproj -scheme SPMTest clean build archive CODE_SIGNING_ALLOWED=NO

Will try 14.3.1 with 5.8 If this fails, it might be that the new Swift 5.8 expects latest parameters for .package(url:..) I've tried the name in the dependency for PayPalCheckout as defined in Package.swift for native checkout and also its name in the url "paypalcheckout-ios" and they both fail.

This also caused an error and 14.3 with 5.8 with new arguments also caused an error.

Output: Run xcodebuild -project 'SampleApps/SPMTest/SPMTest.xcodeproj' -scheme 'SPMTest' clean build archive CODE_SIGNING_ALLOWED=NO 2023-09-15 17:42:08.399 xcodebuild[3166:16506] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled) Command line invocation: /Applications/Xcode_14.3.1.app/Contents/Developer/usr/bin/xcodebuild -project SampleApps/SPMTest/SPMTest.xcodeproj -scheme SPMTest clean build archive CODE_SIGNING_ALLOWED=NO

User defaults from command line: IDEPackageSupportUseBuiltinSCM = YES

Build settings from command line: CODE_SIGNING_ALLOWED = NO

Resolve Package Graph

Fetching from https://github.com/paypal/paypal-ios

Fetching from https://github.com/paypal/paypalcheckout-ios (cached)

Creating working copy of package ‘paypal-ios’

Checking out bumpXcode14_3 of package ‘paypal-ios’

Creating working copy of package ‘paypalcheckout-ios’

Checking out 1.1.0 of package ‘paypalcheckout-ios’

product 'paypalcheckout-ios' required by package 'paypal-ios' target 'PayPalNativePayments' not found. 2023-09-15 17:43:58.421 xcodebuild[3166:16506] Writing error result bundle to /var/folders/k1/d12mwq8j1qs35vb23_t_y72h0000gn/T/ResultBundle_2023-15-09_17-43-0058.xcresult Resolved source packages: PayPal: https://github.com/paypal/paypal-ios @ bumpXcode14_3 PayPalCheckout: https://github.com/paypal/paypalcheckout-ios @ 1.1.0

xcodebuild: error: Could not resolve package dependencies: product 'paypalcheckout-ios' required by package 'paypal-ios' target 'PayPalNativePayments' not found.

Error: Process completed with exit code 74.

scannillo commented 1 year ago

This SDK supports Swift 5.7+. This SDK is written in Swift.

This line in the README needs to be updated, and this PR also needs a CHANGELOG entry

KunJeongPark commented 1 year ago

Note for future reference.

The issue was when we bumped the Swift version to 5.8, the deprecated function parameters for fetching paypalcheckout-ios didn't work properly. ( .package(name: "PayPalCheckout", url: "https://github.com/paypal/paypalcheckout-ios", .exact("1.1.0"))) When we used the new parameters (.package(url: "https://github.com/paypal/paypalcheckout-ios", from: "1.1.0")), there was no association between the package fetched and the package name declared in the Package.swift of native checkout package. So solution was explicit association of the product and package names in the dependency list for the PayPalNativePayments target.

References: https://github.com/apple/swift-package-manager/blob/main/CHANGELOG.md#swift-58 https://developer.apple.com/documentation/packagedescription/package/dependency/package(url:branch:) https://forums.swift.org/t/why-does-swiftpm-use-github-repo-name-and-not-package-swift-name/55085/7