Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift Package Manager not resolving

I'm currently trying to use Swift Package Manager on a Perfect Server Side Swift project but when I run Swift package update it never resolves. Using the verbose flag it seems to keep cycling through the same dependencies over and over again.

Where I think the issue started is I'm trying to create a custom package to import into my project. I'm trying to build the package in a way that I can import it into other projects going forward. The issue is that my package itself relies on one of the Perfect Dependencies. If I remove my custom package from the overall project package the dependencies download successfully. So I can only assume it's my package that has the problem.

The dependencies for my package look like this

let package = Package(
    name: "TestPackage",
    products: [
        // Products define the executables and libraries produced by a package, and make them visible to other packages.
        .library(
            name: "TestPackage",
            targets: ["TestPackage"]),
    ],
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
    .Package(url: "https://github.com/PerfectlySoft/Perfect-HTTP.git", majorVersion: 3),
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages which this package depends on.
        .target(
            name: "TestPackage",
            dependencies: ["PerfectHTTP"]),
        .testTarget(
            name: "TestPackageTests",
            dependencies: ["TestPackage"]),
    ]
)

Then my package.swift file for my main project looks like this

let package = Package(
    name: "json_api",
    targets: [],
    dependencies: [
        .Package(url: "https://github.com/PerfectlySoft/Perfect-HTTPServer.git", majorVersion: 3),
        .Package(url:"/local/path/to/TestPackage", majorVersion:0, minor:1),
    ]
)

As you can see they both import the Perfect-HTTP package (Perfect-HTTP-Server does this via

.package(url: "https://github.com/PerfectlySoft/Perfect-HTTP.git", from: "3.0.0"), )

When it hangs it keeps getting Perfect-COpenSSL and Perfect-Thread though rather than Perfect-HTTP

I'm pretty new to SPM and this is the first time I've tried created my own package. How should I go about trying to resolve what I can only assume is some kind of circular dependency issue?

like image 385
TommyBs Avatar asked Nov 22 '17 09:11

TommyBs


1 Answers

So I managed to resolve this and thought it might be useful for others.

I had made my version tag in git as 'v0.1' whereas I needed to give it full semantic versioning e.g 0.1.0 as the tag and that worked succesfully

like image 94
TommyBs Avatar answered Sep 25 '22 13:09

TommyBs