33

The Cartfile documentation makes the assertion:

If no version requirement is given, any version of the dependency is allowed.

with the contradictory example:

# Use the latest version
github "jspahrsummers/xcconfigs"

Furthermore, it is not stated, but from testing, I infer that "latest" is actually the version of the latest tag. Is this interpretation correct? And if so, how does one specify the very latest commit - do you have to manually check and specify the latest commit, or is there a simpler way?

Chris Conover
  • 8,889
  • 5
  • 52
  • 68

4 Answers4

55

The documentation states

Carthage supports several kinds of version requirements:

  • >= 1.0 for “at least version 1.0”
  • ~> 1.0 for “compatible with version 1.0”
  • == 1.0 for “exactly version 1.0”
  • "some-branch-or-tag-or-commit" for a specific Git object (anything allowed by git rev-parse)

so I believe

github "jspahrsummers/xcconfigs" "HEAD"

should work as expected, since "HEAD" is a valid argument for git rev-parse

Alternatively

github "jspahrsummers/xcconfigs" "master"

or any other branch

Gabriele Petronella
  • 106,943
  • 21
  • 217
  • 235
  • Indeed it does, and is the best answer. I'll mark this as such once the embargo lifts. - Thanks. – Chris Conover Jul 16 '15 at 16:47
  • 4
    Adding ``github "eonist/swift-utils" "39c35f4"`` to a Cartfile worked for me. ``39c35f4`` would be the id of the latest commit – Sentry.co Feb 02 '17 at 15:29
  • And can you use github "eonist/swift-utils" "develop" "39c35f4"? Hi @Eonist :) edit: actually you can do it without specifying the branch, it find it itself –  Mar 02 '17 at 10:49
  • Is it possible to have versioning if Cartfile aims the branch other than `master`? If yes, how is this achieved in Cartfile itself and what does repo need to support in order to make it possible? – uerceg Apr 17 '18 at 09:58
5

Simply github "jakecraige/RGB" will yell No tagged versions found for github "jakecraige/RGB"

Better is to use github "jakecraige/RGB" "master"

You may want to read Carthage Tutorial: Getting Started

branch name / tag name / commit name means “Use this specific git branch / tag / commit”. For example, you could specify master, or a commit has like 5c8a74a.

onmyway133
  • 45,645
  • 31
  • 257
  • 263
1

This was answered by mdiep on Carthage's github page:

The latest version refers to something that has an actual version—a release or tag. If you want the most latest commit, you need to specify the branch you want to pin to.

Chris Conover
  • 8,889
  • 5
  • 52
  • 68
0

Just leave the version number out. Mine looks like this and it works:

github "Alamofire/Alamofire"
github "auth0/JWTDecode.swift"
  • This is incorrect. The [docs](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md) say "If no version requirement is given, any version of the dependency is allowed" – bcattle Dec 04 '15 at 07:38
  • this is acceptable, **if** the framework provider has tagged releases in the repository, which adhere to the semantic version spec. – Stan Mar 17 '16 at 18:41
  • 2
    No, this is not acceptable. He asks for the latest version, not the latest release. If you are developing the framework, making a release for every commit is crazy. – Mark Lilback Mar 23 '16 at 15:31