Skip to content

Infer podspec version from git command#545

Merged
dmbryson merged 3 commits intoswiftlang:masterfrom
igor-makarov:infer-podspec-version
Aug 27, 2019
Merged

Infer podspec version from git command#545
dmbryson merged 3 commits intoswiftlang:masterfrom
igor-makarov:infer-podspec-version

Conversation

@igor-makarov
Copy link
Copy Markdown
Contributor

This PR aims to provide a better solution to 'current version' inference for llbuild when used in CocoaPods directly from git.

When requiring a Pod directly from git, like so:

pod 'llbuild', git: 'https://github.com/apple/swift-llbuild.git'

CocoaPods relies on the .podspec to provide the version that is then used, among other things, for dependency resolution.
SwiftPM, on the other hand, relies solely on SemVer and git tags and implies no versioning in the code itself.

The two ways are ultimately incompatible, but this new approach attempts to bridge them. The main use cases:

  • When requiring a pod directly from git, the version inferred will be the latest SemVer-compatible tag.
  • When requiring a pod from a directory, it's implied that the directory is a git repo. The same logic applies.
  • When pushing a podspec to Trunk with pod trunk push, the validation will be performed for the most recent tag. If it was already pushed, an error will be raised.
  • For a podspec that is uploaded to Trunk, the logic will not be performed - Trunk podspecs are static JSON files with immutable versions.

Copy link
Copy Markdown
Contributor

@dmbryson dmbryson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have much experience with CocoaPods, but from a high level this seems reasonable to me.

@dmbryson dmbryson merged commit cffd683 into swiftlang:master Aug 27, 2019
@neonichu
Copy link
Copy Markdown
Contributor

Doesn't this mean using llbuild from a branch would report the wrong version (latest instead of whatever the branch has)?

@igor-makarov
Copy link
Copy Markdown
Contributor Author

It finds the most recent tag on the current branch. I've tested this on several different scenarios and it seemed to work okay.

@igor-makarov igor-makarov deleted the infer-podspec-version branch February 16, 2020 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants