Shouldn't dependencies that are not included in the same target not conflict? I have getting a dependency resolution error here that I don't understand.
// The swift-tools-version declares the minimum version of Swift required to build this package.
let package = Package(
.package(url: "https://github.com/IBDecodable/IBLinter.git", from: "0.4.23"),
.package(url: "https://github.com/realm/SwiftLint.git", from: "0.39.2")
The error I get is:
because SwiftLint >=0.37.0 depends on Commandant 0.17.0..<0.18.0 and IBLinter 0.4.23 depends on Commandant 0.16.0..<0.17.0, SwiftLint is incompatible with IBLinter.
And because no versions of IBLinter match the requirement 0.4.24..<1.0.0, SwiftLint is incompatible with IBLinter.
And because root depends on IBLinter 0.4.23..<1.0.0 and root depends on SwiftLint 0.39.2..<1.0.0, version solving failed.
Makes sense.. they both depend on incompatible versions of
Commandant , sure, but if you take a look at the
targets I'm not actually including either in the dependencies array. I must be misunderstanding something here...
The current model considers everything to be in a single unified graph, so this is not a bug. It is, however, a reasonable feature request.
If the completion of SE‐0226 gets merged in its current state, your manifest would become valid.
swift build would fetch both packages but none of their dependencies, sidestepping the conflict.
swift run swiftlint would re‐resolve and succeed, and
swift run iblinter would re‐resolve again and also succeed. Since there is still only one graph cache, going back and forth would be slow, but at least it would work.
But don’t hold your breath. It’s not the main purpose of that PR, just a side‐effect. So it could end up taking a different form by the time it is actually part of a release.
An officially supported way to do what you’re trying to do would likely come later on.
Gotcha. Thank you, @SDGGiesbrecht . Best of luck with the PR! I’ll keep an eye on that aspect of the feature. I think others will probably come across this issue too if they manage multiple targets or like in my example, try to manage several command line tools through SwiftPM.
hey @SDGGiesbrecht what was the verdict on this? I saw the PR was merged, but you mentioned that what I'm looking for is not the main purpose of the PR and that it may change. Will I be able to accomplish this in 5.3?
That PR was merged into
master, but hasn’t (and likely won’t be) cherry‐picked into the 5.3 branch. I assume it will automatically end up in a future 5.4 branch, and you can check the pattern of release history to speculate on when that will be released.
A feature that formalizes this sort of tool management would need to go through the evolution process, so keep your eye on the forums and share your thoughts if a proposal appears.
Until formalization, it will most likely remain the way I described earlier. However, I still advise treating the graph‐splitting side effect the way you would an underscored symbol; it does its job reliably at the moment, so it’s fine to use as a development tool, but it could change at any time, so don’t release anything that depends on its continued stability.