Swift Package Manager: dependency rules: "from" vs "upToNextMajor"

183 views Asked by At

Let's consider a common format of listing a dependency inside the package:

.package(url: "ssh://[email protected]:firm/repo.git", from: "1.1.0"),

And this format:

.package(url: "ssh://[email protected]:firm/repo.git", .upToNextMajor("1.1.0"))

Are these declarations equivalent? Or will from declaration update even beyond the major version change, i.e. if 2.0.0 is available, it'll be installed?

1

There are 1 answers

0
Richard Topchii On BEST ANSWER

Yes, these declarations are absolutely equivalent:

.package(url: "ssh://[email protected]:firm/repo.git", from: "1.1.0"),
.package(url: "ssh://[email protected]:firm/repo.git", .upToNextMajor("1.1.0"))

And even in case of the from declaration the update to the next major version won't happen automatically and will require changing the major version to 2 or higher in the declaration.