Cocoapods: Target a branch in the podspec file

Created on 17 Jan 2017  路  5Comments  路  Source: CocoaPods/CocoaPods

Report

What did you do?

pod repo push my-label MyProject.podspec.json --allow-warnings

What did you expect to happen?

Upload the .podspec to my repo

What happened instead?

Linter failed because my spec isn't validate.

CocoaPods Environment

Stack

   CocoaPods : 1.2.0.rc.1
        Ruby : ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-darwin14.0]
    RubyGems : 2.2.2
        Host : Mac OS X 10.11.6 (15G1212)
       Xcode : 8.2.1 (8C1002)
         Git : git version 2.10.1 (Apple Git-78)
Ruby lib dir : /Users/me/.rvm/rubies/ruby-2.1.3/lib
Repositories : my-label - https://github...MyRepo.git @ 72a3959715da8822a19ea7ec5addea5905342ab5
               master - https://github.com/CocoaPods/Specs.git @ 609b1bfead769b438e4885b93815c3c066a50aa4
               SocializeCocoaPods - https://github.com/socialize/SocializeCocoaPods.git @ 303e0319d820eb8e7546e1c2158969c7dc600768

Installation Source

Executable Path: /Users/me/.rvm/gems/ruby-2.1.3/bin/pod

Plugins

cocoapods-deintegrate : 1.0.1
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.1.2
cocoapods-try         : 1.1.0

Podfile

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.3'
use_frameworks!

target 'MyProject' do
    pod 'Alamofire', '~> 4.2.0'
    pod 'CocoaLumberjack/Swift', '~> 3.0.0'
    pod 'SwiftyJSON', '~> 3.1.1'

    pod 'Cleanse', :git => 'https://github.com/square/Cleanse.git', :branch => 'swift-3' 

    pod 'ObjectMapper', '~> 2.2.2' 
    pod 'RealmSwift', '~> 2.1.2'
    pod 'CryptoSwift', '~> 0.6.7'
    pod 'SwiftEventBus', '2.1.2'
end

target 'MyProjectTests' do
    pod 'Quick', '~> 1.0.0' 
    pod 'Nimble', '~> 5.1.1'  
    pod 'Mockingjay', '~> 2.0.0'
    pod 'Dobby', '~> 0.6.0'
end

My understanding of what happen

I'm using Cleanse as Swift Dependency Injection. To install the Swift version, I need to add pod 'Cleanse', :git => 'https://github.com/square/Cleanse.git', :branch => 'swift-3'in my Podfile. So far so good.

But in my MyProject.podspec.json file, it seems I cannot specify a branch, so I just added:

"dependencies": {
    "Cleanse": "~> 0.1.0", // Only the version
    "Alamofire": "~> 4.2.0",
    // ...
  }

And when I'm running the pod repo push command, I guess it retrieves the old Swift2 version based on the following errors:

- ERROR | xcodebuild:  Cleanse/Cleanse/BindingBuilder.swift:111:32: error: '.dynamicType' is deprecated. Use 'type(of: ...)' instead
- ERROR | xcodebuild:  Cleanse/Cleanse/BindingBuilder.swift:141:17: error: expected ',' joining parts of a multi-clause condition
- ERROR | xcodebuild:  Cleanse/Cleanse/ComponentVisitor.swift:118:77: error: expected 'let' in conditional
Etc.

Should I ask Cleanse Team to create a swift version (like all the other libs) or is there a way to specify the branch (or something else..) to fix this ? If so I'm very sorry, I took a good look and found nothing but this thread and the doc.

awaiting input

All 5 comments

I do not think podspecs support specifying a branch for a dependency.

You can also re-publish a podspec in an internal repo of yours with your own internal version that points to the branch you want.

Alternatively, as you said you can ask for a pre-release perhaps 0.1.0-swift3 or something.

@duribreux as long as the version in the podspec file on the branch you specified in your podfile matches the version of the dependency your other pod needs, then it should all work. So, as long as the branch's podspec for Cleanse also says something that matches ~> 0.1.0, you should be in good shape. Could you verify that?

@benasher44 Sorry I missed your answer within my notifications.
Sadly I won't be able to give more information about this issue due to my new position and loss of access to this project.

Maybe adding the version within my Podspec would have helped even if I think I probably tried back in the time. You can probably close this issue or keep it as a reminder for further investigations.

Regards.

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pallaviMN picture pallaviMN  路  3Comments

Mingmingmew picture Mingmingmew  路  3Comments

gerchicov-bp picture gerchicov-bp  路  3Comments

pronebird picture pronebird  路  3Comments

5SMNOONMS5 picture 5SMNOONMS5  路  3Comments