Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swift-system dependency version should be a version number instead of a branch #7

Open
DMAPro opened this issue Jun 6, 2023 · 1 comment

Comments

@DMAPro
Copy link

DMAPro commented Jun 6, 2023

Hello,

The swift-system dependency is currently specified as

        .package(
            url: "https://github.com/PureSwift/swift-system",
            branch: "feature/dynamic-lib"
        )

So, a branch is specified instead of a version number. This causes an issue when linking the Socket library to a package.
E.g. if I'm making a package and I add a dependency like this:

.package(url: "[email protected]:PureSwift/Socket.git", from: "0.3.2")

I get an error, because SPM doesn't allow mixing and matching a stable version of the Socket package with an "unstable" version of the swift-system dependency:

Failed to resolve dependencies Dependencies could not be resolved because root depends on 'socket' 0.3.2..<1.0.0.
'socket' >= 0.3.2 cannot be used because no versions of 'socket' match the requirement 0.3.3..<1.0.0 and package 'socket' is required using a stable-version but 'socket' depends on an unstable-version package 'swift-system'.

A workaround is to use an "unstable" version for both (or rather a version that SPM deems unstable). For example, I'm linking a specific commit (for version 0.3.2):

.package(url: "[email protected]:PureSwift/Socket.git", revision: "489e63b")

However, as you can imagine, it's not super convenient :)

If you could fix the dependency declaration for the swift-system package, it would be much appreciated!

In any case, thank you for your work! :)

@stackotter
Copy link

+1 to this! I've got a fork which fixes this issue but it'd be good to be able to merge this in to the source repo so that development doesn't get split.

Is there a reason that you'd like swift-system to be able to be compiled as a separate dynamic library instead of directly into the Socket library? I assume it's probably code size, but a debug build of Socket (as a dylib) is 1.6mb and a release build is 889kb, so you wouldn't be saving much by ensuring that the same copy of swift-system is used everywhere.

@colemancda I'd love to hear your opinion on how this issue should be approached!

Tl;dr

SwiftPM considers Socket unstable because it depends on your swift-system fork via a branch dependency, which in turn makes it impossible to use Socket without making your own package unstable afaict (and definitely not in a way that has the benefits of semver).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants