How do I update a single dependency with Swift Package Manager?

Viewed 2854

I have a local dependency in my Package.swift in the form of

.package(url: "file:///Users/User/Documents/.../my-dependency", .branch("master")),

The local dependency is under development. I wish to update to the latest version, but I cannot find a way to update only that package without having to pull and rebuild all the other project dependencies. So far I have to pull and rebuild Vapor and Fluent every time I make a small change to a local dependency (assuming I even have internet access).

When I run swift package update --help I see there is an instruction :

POSITIONAL ARGUMENTS:
packages        The packages to update (optional)

However, whenever I try something like swift package update my-dependency or swift package update My-Dependency, it does the same thing and re-pulls all.

How do I go about updating this single dependency? And assuming I eventually do want to update all my other third-party dependencies, how do I tell SPM to check if there is an actual change to the package on GitHub before re-pulling and rebuilding it?

1 Answers

I found the solution :

.package(path: "path/to/dependency")

No need to run swift package update, it builds with the current local version. Also no need to commit the changes in the dependency each time.

See answer here by rounak

Related