Incompatible with swift-argument-parser v1.0.0+
pitfield opened this issue · 9 comments
BlueSocket currently has a dependency on swift-argument-parser version 0.4.1..<1.0. This prevents use of the current v1.1.3 release of swift-argument-parser. (swift-argument-parser version 1.0 was released 2021-09-10.)
Could BlueSocket be made compatible with the current release of swift-argument-parser and this version constraint relaxed in Package.swift?
Background: This issue surfaced in PostgresClientKit (which I maintain); see Issue #41. The person reporting the issue wondered why BlueSocket has a dependency on swift-argument-parser. Could you please comment on that? This dependency appears to have been introduced last year by @dannys42 in commit 4dd6c81. Is this dependency required only for testing?
Thanks!
Hi @pitfield , yes you are correct swift-argument-parser is being used by some test/sample CLI commands. But the dependency is clearly not in the library. It's kind of peculiar that SPM would consider it required for packages that depend on this.
I just tried building PostgresClientKit. I did not encounter any build issues or dependencies with Swift Argument Parser:
Fetching https://github.com/IBM-Swift/BlueSSLService
Fetching https://github.com/IBM-Swift/BlueSocket.git
Fetching https://github.com/apple/swift-argument-parser from cache
Fetched https://github.com/IBM-Swift/BlueSSLService (1.37s)
Fetched https://github.com/IBM-Swift/BlueSocket.git (1.37s)
Computing version for https://github.com/IBM-Swift/BlueSSLService
Fetched https://github.com/apple/swift-argument-parser (1.45s)
Computed https://github.com/IBM-Swift/BlueSSLService at 2.0.1 (0.43s)
Computing version for https://github.com/IBM-Swift/BlueSocket.git
Computed https://github.com/IBM-Swift/BlueSocket.git at 2.0.2 (0.46s)
Computing version for https://github.com/apple/swift-argument-parser
Computed https://github.com/apple/swift-argument-parser at 0.5.0 (0.49s)
Creating working copy for https://github.com/IBM-Swift/BlueSocket.git
Working copy of https://github.com/IBM-Swift/BlueSocket.git resolved at 2.0.2
Creating working copy for https://github.com/IBM-Swift/BlueSSLService
Working copy of https://github.com/IBM-Swift/BlueSSLService resolved at 2.0.1
Creating working copy for https://github.com/apple/swift-argument-parser
Working copy of https://github.com/apple/swift-argument-parser resolved at 0.5.0
warning: 'bluesslservice': 'bluesslservice' dependency on 'https://github.com/Kitura/BlueSocket.git' conflicts with dependency on 'https://github.com/IBM-Swift/BlueSocket.git' which has the same identity 'bluesocket'. this will be escalated to an error in future versions of SwiftPM.
Building for debugging...
[78/78] Compiling PostgresClientKit LogRecord.swift
Build complete! (9.00s)
I'm building with 5.7, though.
Unrelated note: "IBM-Swift" should now be replaced with "Kitura".
Thank you for taking a look at this.
I think I was unclear; my apologies. PostgresClientKit does not itself use swift-argument-parser. However its dependency on BlueSocket means PostgresClientKit cannot be used in any project already using swift-argument-parser version 1.0.0+.
I have created this repository with a standalone reproducible test case. This fails to build, both on Swift 5.5.2 (on MacOS) and Swift 5.6.2 (Ubuntu 20.04).
Here is the error I see:
% swift --version
swift-driver version: 1.26.21 Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
Target: x86_64-apple-macosx11.0
% swift package reset && swift build
Fetching https://github.com/apple/swift-argument-parser from cache
Fetching https://github.com/IBM-Swift/BlueSocket from cache
Fetched https://github.com/IBM-Swift/BlueSocket (1.55s)
Fetched https://github.com/apple/swift-argument-parser (1.58s)
Computing version for https://github.com/apple/swift-argument-parser
Computed https://github.com/apple/swift-argument-parser at 1.1.3 (0.03s)
Computing version for https://github.com/IBM-Swift/BlueSocket
Computing version for https://github.com/IBM-Swift/BlueSocket
error: Dependencies could not be resolved because root depends on 'swift-argument-parser' 1.1.3..<2.0.0.
'swift-argument-parser' 0.4.1..<1.0.0 is required because 'BlueSocket' >= 2.0.0 depends on 'swift-argument-parser' 0.4.1..<1.0.0 and root depends on 'BlueSocket' 2.0.0..<3.0.0.
Thank you for the reminder about "IBM-Swift".
@pitfield Thanks for the clarification. I wonder if this is because BlueSocket is still using the Swift 5.0 package file format? I see that PostgresClientKit also has a minimum of Swift 5.0. Do you have any objection if I raise the minimum to Swift 5.2?
@dannys42 I forked BlueService, tried switching to the SPM 5.2 grammar, and changed the test case to be dependent on the fork. Unfortunately, I am still getting the same dependency resolution error. Does switching to SPM 5.2 work for you?
I am OK requiring Swift 5.2+ if there is no better option. But is it possible to make BlueService dependent on swift-argument-parser 1.0.0+?
Thanks!
@pitfield Thank you so much for testing that! This really seems like an SPM bug to me.
I don't mind bumping the version of Swift Argument Parser, but it is definitely wrong that this shows up as a dependency requirement for people just using the library. I think I will restructure the project so that the example programs have their own Package.swift file to alleviate this issue.
Works in v2.0.3. Thank you!