How to use local-only project via CocoaPods
Asked Answered
S

3

8

I am struggling to find a way to package an Xcode framework we created as a Pod that would only be used internally (not public, not on github).

How do I modify the .podspec to build the SDK from the local Xcode project on my development machine?

Signorina answered 17/12, 2018 at 14:51 Comment(4)
You can use :path => for a local pod. But is your Pod in any Git repository (even if private)?Acanthus
My idea is to have the Pod only locally so that I can use it only for debugging purposes and therefore not host it on any Git repository (neither private nor public). @AcanthusSignorina
In your podfile you can use as said :path => to your local pod. I don't know how to bypass the source issue doing a pod spec lint though.Acanthus
But how to create that local pod? All i have is the source for the pod so I would like to find a way to package that source code into a local pod?Signorina
T
7

Short answer: you don't use the .podspec for this. Longer: the .podfile is mainly for specifying:

  • external dependencies
  • what to snarf out of the project, relative to the project folder

IIRC, other than some informational metadata, the .podspec does not address how you get to that project folder, as this is handled separately.

As mentioned in the comments, you can use the Podfile to use a local project, with the :path => directive pointing to a local project folder. For example, you have the project in /Users/me/proj -- and the .podspec lives at the top-level -- your Podfile would have an entry like:

pod 'MyPodName', :path => '/Users/me/proj'

Warning: when you run pod {update, install}, this will pull whatever is checked out locally in that project at the time.

Tetrapod answered 18/12, 2018 at 1:22 Comment(0)
N
12

Local CocoaPods

[Dependency manager]

[Cocoapods with specyfic branch]

Example with Git: enter image description here

Textual

Podfile

//Podfile pod supports:
//default(try to find .podcpec in centralised repo), path
//-remote    
    pod 'PodName'
//-local     
    //local_path can be absolute or relative
    pod 'PodName', :path => '<local_path>.podspec'

Podspec

//Podspec source supports:
//git, svn, hg, http
//-remote    
    s.source = { :git => "https://url_to.git", :tag => "git_tag" }
//-local     
    s.source = { :git => 'file:///path_to_git_folder', :tag => "git_tag" }
    //or, where path_to_git_folder can be relative
    s.source = { :git => '/path_to_git_folder', :tag => "git_tag" }

Do not forget to commit your changes beforehand. git_tag can be the same as a branch name.

Several useful commands:

Update:

Podfile:

pod update

Check .podspec:

pod spec lint "<some_path>.podspec" --quick
pod spec lint "<some_path>.podspec" --verbose --allow-warnings

Register session:

pod trunk register <email> '<name>' --description='<description>' 

Release:

pod trunk push <file>.podspec --verbose --allow-warnings

Pod search[About]:

pod search <pod_name>

[Local Carthage] [Local Swift Package Manager]

[Android Maven local]

Natterjack answered 5/9, 2019 at 21:7 Comment(0)
T
7

Short answer: you don't use the .podspec for this. Longer: the .podfile is mainly for specifying:

  • external dependencies
  • what to snarf out of the project, relative to the project folder

IIRC, other than some informational metadata, the .podspec does not address how you get to that project folder, as this is handled separately.

As mentioned in the comments, you can use the Podfile to use a local project, with the :path => directive pointing to a local project folder. For example, you have the project in /Users/me/proj -- and the .podspec lives at the top-level -- your Podfile would have an entry like:

pod 'MyPodName', :path => '/Users/me/proj'

Warning: when you run pod {update, install}, this will pull whatever is checked out locally in that project at the time.

Tetrapod answered 18/12, 2018 at 1:22 Comment(0)
S
0

You just need a private Git repository, add as a source to Podfile Then deciding if the framework is going to be closed source or open source, then podspec file will be different. all the pod repo ... will help you Doc

Scabious answered 18/12, 2018 at 2:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.