How to use SPMUtility as a dependency with SwiftPM

I'm trying to use the SPMUtility lib, and I can't find any info on using it since it's name was changed to SPMUtility.

In my Package.swift I have

let package = Package(
    ...
    dependencies: [
        .package(url: "https://github.com/apple/swift-package-manager.git", from:"0.3.0"),
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.

        .target(
            ...
            dependencies: ["Utility"]),
...

0.3.0 is the highest version I could find. And when I use it I get warnings about deprecated code from the lib that is no longer in the files on GitHub. I can't find any information about releases or updates to this library.

Questions:

  • Am I correct in thinking that the name Utility is deprecated and the lib is now SPMUtility
  • What is the latest release of this lib? How can I actually find that out in the future?
1 Like

Am I correct in thinking that the name Utility is deprecated and the lib is now SPMUtility

It is SPMUtility now; Utility no longer exists.

What is the latest release of this lib?

There is no tagged semantic version in the official repository compatible with Swift 5. That is not because there cannot or should not be, but merely because no one did it. You can read the details over in this thread.

The source works fine, so I forked it and tagged a Version 0.0.50000 to correspond with Swift 5.0.0. (It works with Swift 5.0.1 too.) As long as the package manager remains open source, I am committed to tagging any future releases the main repository neglects in the same way.

There is also no documentation hosted anywhere. You can use a tool of mine called Workspace to scan its API locally:

cd /path/to/repository/with/checkout/of/swift-package-manager
workspace document
open docs/index.html

(Edit: You may have to first add a dummy configuration specifying some options like the localization. If it needs you to specify something, it will tell you.)

I also have a wrapper around the package manager, SDGSwift that makes many common tasks much easier. You can use the wrapper as an example of how to use the SwiftPM package, or if you find it helpful, you can even link against the wrapper itself.

How can I actually find [the lastest version] out in the future?

It is not posted anywhere, and GitHub’s list is cluttered with other tags. If you query the tag list with Git, the semantic versions sort nicely into a group together:

$ git ls-remote --tags https://github.com/apple/swift-package-manager
90abb3c4c9415afee34291e66e655c58a1902784	refs/tags/0.1.0
63a01220e93271dc3bf204b9e13dd1aeb2beefee	refs/tags/0.2.0
6983434787dec4e543e9d398a0a9acf63ccd4da1	refs/tags/0.2.1
235aacc514cb81a6881364b0fedcb3dd083228f3	refs/tags/0.3.0
865c2786498a0e0d95d3f0acf8dd793ef4972ff1	refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a
65c730cd2f941b6b41a9b6c4f942ffb9537bd747	refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a^{}
[...]

(FYI, @Aciid)

I've been juggling a lot of things and this slipped my mind. I've published a new tag 0.4.0 for SwiftPM that depends on llbuild @ 0.1.0 ..< 0.2.0

I understand it can be hard to find semver tags for SwiftPM on GitHub. Maybe we can list them in this document?

2 Likes

Just noticed the release does not include the linker flags necessary for use with Xcode. :frowning_face:

Next time I guess.

Just cherry-picked that change and released a new tag 0.1.1: Release 0.1.1: Update manifest to tools version 5 · apple/swift-llbuild · GitHub

Wow, that was fast!

Works like a charm.

Thank you @Aciid.

1 Like