CocoaPods: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
 
(55 intermediate revisions by the same user not shown)
Line 3: Line 3:
pod --version
pod --version
pod repo update
pod repo update
cd /opt/dev/cki_workspaces/
cd /opt/dev/chorke/academia/code/base_workspaces/
cd ./init_workspace/chorke-init-iosapp/
cd ./core_workspace/academia-core-ioslib/
 
pod init
pod init
vim Podfile  
vim Podfile  
open -a xcode Podfile
pod install
pod install
</source>
1. Target > building settings > ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES, Value type is Boolean, click on the other, change the value to $(inherited)
2. pod update
3. Done
==MergePBX==
<source lang="bash">
brew install mergepbx
git config --global merge.mergepbx.name "XCode project files merger"
git config --global merge.mergepbx.driver "mergepbx %O %A %B"
# git config --global core.attributesfile ~/.gitattributes
echo '*.pbxproj merge=mergepbx' >> ~/.gitattributes
</source>
</source>


Line 14: Line 29:
pod deintegrate
pod deintegrate
sudo gem install cocoapods-clean
sudo gem install cocoapods-clean
cd /opt/dev/cki_workspaces/
sudo gem install cocoapods -v 1.9.1
cd ./init_workspace/chorke-init-iosapp/
cd /opt/dev/chorke/academia/code/base_workspaces/
cd ./init_workspace/academia-init-iosapp/
 
pod clean
pod clean
pod setup
pod setup
pod install
pod install
</source>
==Podspec==
<source lang="bash">
pod lib create AcademiaCoreLIB
cd AcademiaCoreLIB/
pod lib lint AcademiaCoreLIB.podspec
pod repo push AcademiaCoreLIB AcademiaCoreLIB.podspec
ls -la ~/.cocoapods/repos/AcademiaCoreLIB/AcademiaCoreLIB/1.0.0/
pod repo add AcademiaCoreLIB bit.chorke.org:chorkeorg/academia-core-ioslib.git
</source>
<source lang="bash">
pod spec create AcademiaCoreLIB
open -a Xcode AcademiaCoreLIB.podspec
pod spec lint AcademiaCoreLIB.podspec
pod lib lint
</source>
<source lang="bash">
:'
git tag -d v1.0.0
git push --delete origin v1.0.0
'
git tag v1.0.0
git push origin v1.0.0
</source>
<source lang="bash">
pod trunk register devs@chorke.org 'Chorke Academia' --description='Chorke Academia, Inc.'
pod trunk push
</source>
<source lang="bash">
pod install
# pod repo update
pod update AcademiaCoreLIB
pod install --repo-update
</source>
==Private Podspec==
<source lang="bash">
pod repo add AcademiaCoreLIB bit.chorke.org:chorkeorg/academia-core-ioslib.git
cd ~/.cocoapods/repos/AcademiaCoreLIB/; pod repo lint .
pod repo push AcademiaCoreLIB AcademiaCoreLIB.podspec
pod repo remove AcademiaCoreLIB
</source>
<source lang="ini">
# add to podfile as pod dependency
pod 'AcademiaCoreLIB', :git => 'bit.chorke.org:chorkeorg/academia-core-ioslib.git'
</source>
==Static Framework==
Like <code>pod 'GoogleMaps', '~> 3.8.0'</code>  there are some static frameworks. I mean framework inside framework. For what we have to add the property as below in '''Podspec''' for the dependency pod framework where static framework or has pod dependency like <code>pod 'GoogleMaps', '~> 3.8.0'</code>
s.static_framework = true
<code>use_frameworks! :linkage => :static</code> is the alternative of the dependency framework '''Podspec''' <code>s.static_framework = true</code> property. If <code>s.static_framework = true</code> property missed in the '''Podspec''' of any dependency framework which contains static framework then we could use <code>use_frameworks! :linkage => :static</code> in the dependent '''Podfile''' to handle such static framework.
use_frameworks! :linkage => :static
==Private Pod Patch==
<source lang="bash">
tag='v1.0.0';git tag -d $tag;git push --delete origin $tag;\
git tag $tag; git push origin $tag
</source>
<source lang="bash">
url=bit.chorke.org:chorkeorg/academia-core-ioslib.git;pod='AcademiaCoreLIB';\
pod repo remove $pod;pod repo add $pod $url;pod update $pod
url=bit.chorke.org:chorkeorg/academia-core-iossql.git;pod='AcademiaCoreSQL';\
pod repo remove $pod;pod repo add $pod $url;pod update $pod
url=bit.chorke.org:chorkeorg/academia-core-iosapi.git;pod='AcademiaCoreAPI';\
pod repo remove $pod;pod repo add $pod $url;pod update $pod
url=bit.chorke.org:chorkeorg/academia-core-iosgui.git;pod='AcademiaCoreGUI';\
pod repo remove $pod;pod repo add $pod $url;pod update $pod
</source>
<source lang="bash">
url=bit.chorke.org:chorkeorg/academia-rupa-iossql.git;pod='AcademiaRupaSQL';\
pod repo remove $pod;pod repo add $pod $url;pod update $pod
url=bit.chorke.org:chorkeorg/academia-rupa-iosapi.git;pod='AcademiaRupaAPI';\
pod repo remove $pod;pod repo add $pod $url;pod update $pod
url=bit.chorke.org:chorkeorg/academia-rupa-iosvum.git;pod='AcademiaRupaVUM';\
pod repo remove $pod;pod repo add $pod $url;pod update $pod
url=bit.chorke.org:chorkeorg/academia-rupa-iosgui.git;pod='AcademiaRupaGUI';\
pod repo remove $pod;pod repo add $pod $url;pod update $pod
</source>
==Multiple Commands Error==
For '''Xcode 11.4''' please select the '''Xcode''' menu item as following:
File » Workspace Settings » Shared Workspace Settings » Build System » Legacy Build System
⌘ + Shift + Option + K
⌘ + Shift + K
⌘ + Shift + R
⌘ + R
⌘ + U
<source lang="bash">
p='academia-main-iosapp';b="$p.bkp";if [ -d "$b" ];then rm -rf $b;fi;mv $p $b;\
git clone "bit.chorke.org:chorkeorg/$p.git";if [ -d "$p" ];then cd $p;\
cp ../$b/Podfile* .;pod install;git status;cd ..;fi
</source>
==Xcode Freeze==
<source lang="bash">
sudo rm -rf ~/Library/Developer/Xcode/
sudo rm -rf ~/Library/Saved\ Application\ State/com.apple.dt.Xcode.savedState/
</source>
</source>


==References==
==References==
{|
| valign="top" |
* [https://medium.com/@shahabejaz/create-and-distribute-private-libraries-with-cocoapods-5b6507b57a03 Distribute Private Libraries with Cocoapods]
* [https://stackoverflow.com/questions/46428752 Clean specific pod from the local cache]
* [https://medium.com/flawless-app-stories/create-your-own-cocoapods-library-da589d5cd270 Create your own CocoaPods library]
* [https://medium.com/flawless-app-stories/create-your-own-cocoapods-library-da589d5cd270 Create your own CocoaPods library]
* [https://www.raywenderlich.com/5823-how-to-create-a-cocoapod-in-swift How to Create a CocoaPod in Swift]
* [https://stackoverflow.com/questions/40599454 Use the <code>'$(inherited)'</code> flag]
* [https://stackoverflow.com/questions/55011171 Unable to load contents of file list]
* [https://stackoverflow.com/questions/55011171 Unable to load contents of file list]
* [https://medium.com/flawless-app-stories/getting-started-with-reusable-frameworks-for-ios-development-f00d74827d11 Reusable Frameworks for iOS]
* [https://medium.com/flawless-app-stories/getting-started-with-reusable-frameworks-for-ios-development-f00d74827d11 Reusable Frameworks for iOS]
* [https://guides.cocoapods.org/syntax/podspec.html Podspec Syntax Reference]
* [https://stackoverflow.com/questions/50199354 Add Git Repository as Pod]
* [https://guides.cocoapods.org/using/pod-install-vs-update.html Pod install vs. pod update]
| valign="top" |
* [https://stackoverflow.com/questions/61442990 GoogleMaps causes build error as an indirect dependency]
* [https://help.apple.com/xcode/mac/current/#/dev14a2fd0c0 If multiple commands produce the same output]
* [https://medium.com/@ihabshea/how-to-get-cocoapods-working-on-macos-big-sur-c09e5d6e4d51 CocoaPods working on MacOS Big Sur]
* [https://medium.com/@mattoakes/a-better-way-to-automatically-merge-changes-in-your-xcode-project-files-3d83b3583fe4 Automatically Merge XCode Project]
* [https://stackoverflow.com/questions/50718018 Error: Multiple commands produce]
* [[Xcode Clean up Installation]]
* [https://developer.apple.com/support/code-signing/ Developer Code Signing]
* [http://guides.cocoapods.org/making/private-cocoapods.html Private Pods]
| valign="top" |
|-
| colspan="3" |
----
|-
| valign="top" |
* [[Maven]]
* [[Conan]]
* [[Bazel]]
* [[NPM]]
* [[Yarn]]
* [[Ant]]
* [[Ivy]]
| valign="top" |
| valign="top" |
|}

Latest revision as of 21:59, 18 January 2024

Install

pod --version
pod repo update
cd  /opt/dev/chorke/academia/code/base_workspaces/
cd ./core_workspace/academia-core-ioslib/

pod init
vim Podfile 
open -a xcode Podfile
pod install
1. Target > building settings > ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES, Value type is Boolean, click on the other, change the value to $(inherited)
2. pod update
3. Done

MergePBX

brew install mergepbx
git config --global merge.mergepbx.name "XCode project files merger"
git config --global merge.mergepbx.driver "mergepbx %O %A %B"
# git config --global core.attributesfile ~/.gitattributes
echo '*.pbxproj merge=mergepbx' >> ~/.gitattributes

Fixing

pod deintegrate
sudo gem install cocoapods-clean
sudo gem install cocoapods -v 1.9.1
cd  /opt/dev/chorke/academia/code/base_workspaces/
cd ./init_workspace/academia-init-iosapp/

pod clean
pod setup
pod install

Podspec

pod lib create AcademiaCoreLIB
cd AcademiaCoreLIB/

pod lib lint AcademiaCoreLIB.podspec 
pod repo push AcademiaCoreLIB AcademiaCoreLIB.podspec 
ls -la ~/.cocoapods/repos/AcademiaCoreLIB/AcademiaCoreLIB/1.0.0/
pod repo add AcademiaCoreLIB bit.chorke.org:chorkeorg/academia-core-ioslib.git
pod spec create AcademiaCoreLIB
open -a Xcode AcademiaCoreLIB.podspec
pod spec lint AcademiaCoreLIB.podspec
pod lib lint
:'
git tag -d v1.0.0
git push --delete origin v1.0.0
'
git tag v1.0.0
git push origin v1.0.0
pod trunk register devs@chorke.org 'Chorke Academia' --description='Chorke Academia, Inc.'
pod trunk push
pod install
# pod repo update
pod update AcademiaCoreLIB
pod install --repo-update

Private Podspec

pod repo add AcademiaCoreLIB bit.chorke.org:chorkeorg/academia-core-ioslib.git
cd ~/.cocoapods/repos/AcademiaCoreLIB/; pod repo lint .
pod repo push AcademiaCoreLIB AcademiaCoreLIB.podspec
pod repo remove AcademiaCoreLIB
# add to podfile as pod dependency
pod 'AcademiaCoreLIB', :git => 'bit.chorke.org:chorkeorg/academia-core-ioslib.git'

Static Framework

Like pod 'GoogleMaps', '~> 3.8.0' there are some static frameworks. I mean framework inside framework. For what we have to add the property as below in Podspec for the dependency pod framework where static framework or has pod dependency like pod 'GoogleMaps', '~> 3.8.0'

s.static_framework = true

use_frameworks! :linkage => :static is the alternative of the dependency framework Podspec s.static_framework = true property. If s.static_framework = true property missed in the Podspec of any dependency framework which contains static framework then we could use use_frameworks! :linkage => :static in the dependent Podfile to handle such static framework.

use_frameworks! :linkage => :static

Private Pod Patch

tag='v1.0.0';git tag -d $tag;git push --delete origin $tag;\
git tag $tag; git push origin $tag
url=bit.chorke.org:chorkeorg/academia-core-ioslib.git;pod='AcademiaCoreLIB';\
pod repo remove $pod;pod repo add $pod $url;pod update $pod

url=bit.chorke.org:chorkeorg/academia-core-iossql.git;pod='AcademiaCoreSQL';\
pod repo remove $pod;pod repo add $pod $url;pod update $pod

url=bit.chorke.org:chorkeorg/academia-core-iosapi.git;pod='AcademiaCoreAPI';\
pod repo remove $pod;pod repo add $pod $url;pod update $pod

url=bit.chorke.org:chorkeorg/academia-core-iosgui.git;pod='AcademiaCoreGUI';\
pod repo remove $pod;pod repo add $pod $url;pod update $pod
url=bit.chorke.org:chorkeorg/academia-rupa-iossql.git;pod='AcademiaRupaSQL';\
pod repo remove $pod;pod repo add $pod $url;pod update $pod

url=bit.chorke.org:chorkeorg/academia-rupa-iosapi.git;pod='AcademiaRupaAPI';\
pod repo remove $pod;pod repo add $pod $url;pod update $pod

url=bit.chorke.org:chorkeorg/academia-rupa-iosvum.git;pod='AcademiaRupaVUM';\
pod repo remove $pod;pod repo add $pod $url;pod update $pod

url=bit.chorke.org:chorkeorg/academia-rupa-iosgui.git;pod='AcademiaRupaGUI';\
pod repo remove $pod;pod repo add $pod $url;pod update $pod

Multiple Commands Error

For Xcode 11.4 please select the Xcode menu item as following:

File » Workspace Settings » Shared Workspace Settings » Build System » Legacy Build System
⌘ + Shift + Option + K
⌘ + Shift + K
⌘ + Shift + R
⌘ + R
⌘ + U
p='academia-main-iosapp';b="$p.bkp";if [ -d "$b" ];then rm -rf $b;fi;mv $p $b;\
git clone "bit.chorke.org:chorkeorg/$p.git";if [ -d "$p" ];then cd $p;\
cp ../$b/Podfile* .;pod install;git status;cd ..;fi

Xcode Freeze

sudo rm -rf ~/Library/Developer/Xcode/
sudo rm -rf ~/Library/Saved\ Application\ State/com.apple.dt.Xcode.savedState/

References