Giter VIP home page Giter VIP logo

cocoapods-pod-merge's Introduction

Cocoapods Pod Merge Plugin Gem Version

pod-merge is a Cocoapods plugin to merge dependencies (or pods) used by your Xcode project, to reduce the number of dynamic frameworks your app has to load on app startup.

The plugin introduces a new file to your project: the MergeFile, and hooks into the pre-install phase of pod install to merge your dependencies.

Benchmarks

Based on measurements taken on this repo's example project, merging 8 pods into 3.

pod-merge Benchmarks

According to our experience in Grab, improvements on older devices like the iPhone 5, 6 are more drastic. As a general rule, we've seen dylib loading times decrease by upto 50 ms per dynamic framework reduced on our user's slowest devices. More info here.

Installation

Using Bundler

If your Xcode project does not have a Gemfile yet, it's highly recommended you use bundler to maintain consistent versions of tools like cocoapods within your team. Learn how to set it up here.

To use cocoapods-pod-merge, add this line to your app's Gemfile:

gem 'cocoapods-pod-merge'

And then install it using bundler by executing:

$ bundle install

Note than this is a cocoapods plugin, hence it requires cocoapods as a dependency.

Usage

Using this plugin to merge your pods is a simple three step process:

1. Create a MergeFile

This plugin requires a file called MergeFile. This is how it looks:

group 'Networking'
	pod 'AFNetworking'
	pod 'SDWebImage'
end

The above MergeFile:

  • Defines a group named Networking. This will be the name of the resulting merged pod.
  • Tells the plugin to merge AFNetworking & SDWebImage into Networking

Here's a few important tips to decide what pods to merge.

Important: The MergeFile is pretty strict about it's syntax, so please avoid adding comments or random text to it. To make your life easier, tell your text editor to treat it like a Ruby file.

2. Update your Podfile

Now, update your Podfile to use the plugin, as well as the merged pods:

Add the line plugin 'cocoapods-pod-merge' to the top of your existing Podfile, and modify it to use the merged pod.

plugin 'cocoapods-pod-merge'

target 'MyApp'
	# pod 'AFNetworking' # Not needed anymore, since we'll use the merged Pod
	# pod 'SDWebImage' # Not needed anymore, since we'll use the merged Pod
	pod 'Networking', :path => 'MergedPods/Networking' # The merged pod
end

Things to note:

  • We commented out the pods 'AFNetworking' & 'SDWebImage' above, since these will now be installed as part of the merged Networking framework.
  • We add the merged framework Networking, which is named as the group name defined in our MergeFile
  • The path is fixed, since the plugin will put your merged pods in the MergedPods/<group name> directory.

3. Run Pod Install & Update your Code!

That's it! Just run:

$ bundle exec pod install

If all goes well, the pods should be merged according to your MergeFile, and should be available to use in your project.

There's one more thing! There's no framework such as AFNetworking or SDWebImage available to your project now, since these are now merged into a pod namedNetworking So, as a one time process, replace imports of the merged libraries in your project like

import AFNetworking

to

import Networking.AFNetworking

And that's it! You're done!

Example Project

There's a example project in the repo which shows the plugin in action. To try it out, just open the Terminal in the PodMergeExample directory, and run:

$ bundle install
$ bundle exec pod install

Benchmarks & More Info

To learn more about the performance improvements you can expect, checkout benchmarks.

Curious about how the plugin actually works? Check out inner workings.

MergeFile

The MergeFile has a very similar syntax to your Podfile. It also supports defining multiple groups, which creates multiple merged pods.

Consider a more common Podfile, with lots of pods, fixed versions, and different sources:

target 'MyApp'
	pod 'AFNetworking', '2.7.0'
	pod 'SDWebImage', '~> 5.0'
	pod 'IQKeyboardManager', '6.2.1'
	pod 'TTTAttributedLabel', '2.0.0'
	pod 'MBProgressHUD', :git => 'https://github.com/jdg/MBProgressHUD.git', :tag => '1.1.0'
	pod 'FLAnimatedImage', '1.0.12'
end

Let's group these Pods into two: UI, and Networking. The MergeFile to achieve this would look like this:

group 'Networking'
	pod 'AFNetworking', '2.7.0'
	pod 'SDWebImage', '~> 5.0'
end

group 'UI'
	pod 'IQKeyboardManager', '6.2.1'
	pod 'TTTAttributedLabel', '2.0.0'
	pod 'MBProgressHUD', :git => 'https://github.com/jdg/MBProgressHUD.git', :tag => '1.1.0'
	pod 'FLAnimatedImage', '1.0.12'
end

Two things to note here:

  • The MergeFile supports defining Pods just like your Podfile, with all the options that the Podfile supports, like the :path, :git, :branch arguments.
  • You can have any number of groups in your MergeFile. The resulting merged dependencies will be named by the groups defined in your MergeFile.

You can now modify your original Podfile to use the plugin, and the merged pods instead of the individual pods:

plugin 'cocoapods-pod-merge'

target 'MyApp'
	pod 'Networking', :path => 'MergedPods/Networking'
	pod 'UI', :path => 'MergedPods/UI'
end

That's it! Now just run bundle exec pod install!

Note: Once the pods are merged according to your MergeFile, you should commit the MergeFile into your version control system (like git)

Special Flags

has_dependencies!

If you have a group of Pods that depend on each other and you want merge them, add this flag into that group.

group 'SomePods'
	has_dependencies!
	pod 'ABC'
	pod 'ABCDependsOnThis'
end

This enables an experimental feature where the plugin tries to fix dependency imports. For example, If pod ABC has code like import <ABCDependsOnThis/File.h>, the plugin will automatically convert this import into #import "File.h", since after the merge, the both the pods will be in the same framework.

swift_version!

If you have a group of Swift pods, the plugin automatically finds out the common compatible Swift version across those pods, and sets that as the Swift version for the merged Pod. If you'd like to manually set the Swift version of a group, you can use the swift_version flag like:

group 'SwiftPodsGroup'
	swift_version! '5.0'
	pod 'SwiftPodA'
	pod 'SwiftPodB'
	pod 'SwiftPodC'
end

This is especially handy if some of the pods in your group do not have a Swift Version defined in their podspec.

platform

If you have multiple platforms in your base Podfile, you can specify the platform for each group in your MergeFile

group 'SwiftPodsGroup'
	platform :ios, '11.0'

	pod 'SwiftPodA'
	pod 'SwiftPodB'
	pod 'SwiftPodC'
end

This is helpful when you have a Podfile with Pods for iOS, WatchOS, etc...

Version Control (like git)

You should definitely commit the MergeFile into your repository, since this is just like your Podfile, and is required for the plugin to work.

The plugin creates a directory called MergedPods, where it keeps the source code and podspecs for the merged pods. Whether you decide you commit this directory depends entirely on your team's workflow. A good rule of thumb is if you commit the Pods/ directory created by Cocoapods, then you should commit this directory as well. The obvious upside is that the merged pods are cached, and the merge does not take place everytime pod install is run, unless something changes.

The plugin also creates another directory called MergeCache when it's running. While this directory is removed when the plugin is done, it can be good practice to add to your .gitignore file just in case the plugin fails to remove it.

MergeCache/

If you decide not to commit the MergedPods directory, add that to the .gitignore as well:

MergeCache/
MergedPods/

Tips

This plugin is not a magic bullet that'll merge all your cocoapods into a single framework. Here's a few tips to save you from hard to debug issues after merging your pods.

  • Start small, by merging a small number (2 to 4) of your Pods, and check everything works after the merge.
  • Only pods which expose their full source code can be merged. Pods that do not expose sources, eg: Fabric / Firebase cannot be merged.
  • Don't mix up Swift and Objective-C Pods in the same group.
  • Try to make logical sense of your groups, don't just merge every single Pod your app uses into one giant pod. This can be very fragile, and can lead to hard to debug compilation / linking issues.
  • Refrain from merging complex or specialized pods (like pods written in C/C++). Such pods can have special build settings and compiler flags that can break the other pods that are merged with them.
  • Make sure you add the required flags to relevant groups in your MergeFile.

Troubleshooting

If the above guidelines still do not solve your problem, please report it! Merging Pods is a complex process, and the plugin does not cover all possible use cases or podspec formats. Any feedback or feature suggesions are also encouraged. Bug reports and pull requests are welcome.

License

The cocoapods-pod-merge plugin is available as open source under the terms of the MIT License.

cocoapods-pod-merge's People

Contributors

vkt0r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cocoapods-pod-merge's Issues

Unnecessary import in dependencies

Hello! Thank you for your work!

I have an issue with dependencies.

This is my MergeFile:

group 'Networking'
	has_dependencies!
	swift_version! '5.0'

	pod 'Alamofire'
	pod 'AlamofireImage'
	pod 'AlamofireActivityLogger'
end

After the merge of these pods I get an Xcode error in AlamofireImage files - No such module 'Alamofire'. But if I remove this import statements - everything will be great. (But I have to do it after every bundle exec pod install)

Support multiple Targets in Podfile (error: `Pods` already has a platform set)

If I have multiple targets in my Podfile, then I see an error during pod install

A Podfile with multiple Targets (watchOS, iOS, testing) that each define their platform will results in an error, though this is quite important to support. Thank you.

[!] Invalid `Podfile` file: The target `Pods` already has a platform set..

 #  from [redacted]/MergeCache/Podfile:4
 #  -------------------------------------------
 #  platform :ios, '11.0'
 >  platform :watchos, '3.1'
 #  install! 'cocoapods', :integrate_targets => false, :lock_pod_sources => false
 #  -------------------------------------------

How to use :path argument in MergeFile?

absolute path is OK, but relative path gets an error:

Fetching podspec for DTCoreText from /Users/xxxxx/Documents/projects/test/DependentPods/DTCoreText
Fetching podspec for DTRichTextEditor from DependentPods/DTRichTextEditor
[!] No podspec found for DTRichTextEditor in DependentPods/DTRichTextEditor

I'm sure DTRichTextEditor folder contains a file named 'DTRichTextEditor.podspec'.

my MergeFile:

group 'MyLib'
pod 'DTRichTextEditor', :path => 'DependentPods/DTRichTextEditor'
pod 'DTCoreText', :path => '/Users/xxxxx/Documents/projects/test/DependentPods/DTCoreText'
end

So, what's the problem?

Workflow for building Frameworks to distribute

More of a question - is there a workflow one can use this plugin to build a framework A with its source code, alongside dependency B, and pack it into one single framework that can be shipped standalone?

`Pod` does not specify a Swift version.

A lot of pods give this problem that the 3rd party doesn't specify a Swift version. I get the following error:

- `RxSwift` does not specify a Swift version and none of the targets (`Dummy`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

Previously I used a small script in the Podfile to solve this problem:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        swift_version = SWIFT_VERSION_MAP[target.name] || DEFAULT_SWIFT_VERSION
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = swift_version
        end
    end
end

But I think the plugin gets the pods from the MergeFile so we cannot specify a swift version. How could I solve this without forking all pods and adding the swift version to the Podspec?

receive a error message with "swift_version" when run "bundle exec pod install"

My error messgae:
TheNetworkingpod failed to validate due to 2 errors: - WARN | github_sources: Github repositories should end in.git. - ERROR | [iOS] attributes: Unacceptable type Arrayforswift_version. Allowed values: [String]. - ERROR | [iOS] attributes: Unable to validate swift_version` (Malformed version number string [5.0]).

`

My MergeFile:
`
group 'Networking'
pod 'SwiftyJSON', '> 5.0.0'
pod 'ObjectMapper', '
> 3.5.0'
end

`

NoMethodError - Can't run pod install

While trying to convert a few pods to a group I encountered the following error. At first I grouped Swift and ObjC pods together but then I read the tips section and split them. This didn't fix my issues though.

MergeFile

group 'Obj_C'
    pod 'GCDWebServer'
    pod 'DTCoreText'
    pod 'PureLayout'
end

Podfile

pod 'Obj_C', :path => 'MergedPods/Obj_C'

Error

NoMethodError - undefined method `map' for "Core/Source/default.css":String
Did you mean?  tap
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.1/lib/cocoapods-pod-merge/Main.rb:355:in `block in extract_info_from_podspec'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.1/lib/cocoapods-pod-merge/Main.rb:354:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.1/lib/cocoapods-pod-merge/Main.rb:354:in `extract_info_from_podspec'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.1/lib/cocoapods-pod-merge/Main.rb:267:in `block (2 levels) in merge'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.1/lib/cocoapods-pod-merge/Main.rb:266:in `chdir'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.1/lib/cocoapods-pod-merge/Main.rb:266:in `block in merge'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.1/lib/cocoapods-pod-merge/Main.rb:214:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.1/lib/cocoapods-pod-merge/Main.rb:214:in `merge'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.1/lib/cocoapods-pod-merge/Main.rb:68:in `block in begin'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.1/lib/cocoapods-pod-merge/Main.rb:67:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.1/lib/cocoapods-pod-merge/Main.rb:67:in `begin'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.1/lib/cocoapods_plugin.rb:8:in `block in <module:CocoapodsPodMerge>'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/hooks_manager.rb:124:in `block (3 levels) in run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/hooks_manager.rb:116:in `block (2 levels) in run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/hooks_manager.rb:115:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/hooks_manager.rb:115:in `block in run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/hooks_manager.rb:114:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:599:in `run_plugins_pre_install_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:219:in `block in prepare'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:215:in `prepare'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:155:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/cli/exec.rb:74:in `load'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/cli/exec.rb:74:in `kernel_load'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/cli/exec.rb:28:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/cli.rb:463:in `exec'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/cli.rb:27:in `dispatch'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/cli.rb:18:in `start'
/Library/Ruby/Gems/2.6.0/gems/bundler-1.17.2/exe/bundle:30:in `block in <top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/Library/Ruby/Gems/2.6.0/gems/bundler-1.17.2/exe/bundle:22:in `<top (required)>'
/usr/bin/bundle:23:in `load'
/usr/bin/bundle:23:in `<main>'

How to merge pod that contains subspec?

i use a pod that contains subspec like AppAuth/Core, AppAuth/ExternalUserAgent
it always fail the execute pod install

MergeFile

group 'Views'
    pod 'AppAuth/Core'
end

Error

NoMethodError - undefined method `first' for nil:NilClass
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.3/lib/cocoapods-pod-merge/Main.rb:159:in `block (2 levels) in parse_mergefile'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.3/lib/cocoapods-pod-merge/Main.rb:137:in `each_line'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.3/lib/cocoapods-pod-merge/Main.rb:137:in `block in parse_mergefile'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.3/lib/cocoapods-pod-merge/Main.rb:134:in `open'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.3/lib/cocoapods-pod-merge/Main.rb:134:in `parse_mergefile'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.3/lib/cocoapods-pod-merge/Main.rb:48:in `begin'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.3/lib/cocoapods_plugin.rb:8:in `block in <module:CocoapodsPodMerge>'
/usr/local/Cellar/cocoapods/1.8.4/libexec/gems/cocoapods-1.8.4/lib/cocoapods/hooks_manager.rb:124:in `block (3 levels) in run'
/usr/local/Cellar/cocoapods/1.8.4/libexec/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:145:in `message'
/usr/local/Cellar/cocoapods/1.8.4/libexec/gems/cocoapods-1.8.4/lib/cocoapods/hooks_manager.rb:116:in `block (2 levels) in run'
/usr/local/Cellar/cocoapods/1.8.4/libexec/gems/cocoapods-1.8.4/lib/cocoapods/hooks_manager.rb:115:in `each'
/usr/local/Cellar/cocoapods/1.8.4/libexec/gems/cocoapods-1.8.4/lib/cocoapods/hooks_manager.rb:115:in `block in run'
/usr/local/Cellar/cocoapods/1.8.4/libexec/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:145:in `message'
/usr/local/Cellar/cocoapods/1.8.4/libexec/gems/cocoapods-1.8.4/lib/cocoapods/hooks_manager.rb:114:in `run'
/usr/local/Cellar/cocoapods/1.8.4/libexec/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:599:in `run_plugins_pre_install_hooks'
/usr/local/Cellar/cocoapods/1.8.4/libexec/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:219:in `block in prepare'
/usr/local/Cellar/cocoapods/1.8.4/libexec/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:145:in `message'
/usr/local/Cellar/cocoapods/1.8.4/libexec/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:215:in `prepare'
/usr/local/Cellar/cocoapods/1.8.4/libexec/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:155:in `install!'
/usr/local/Cellar/cocoapods/1.8.4/libexec/gems/cocoapods-1.8.4/lib/cocoapods/command/install.rb:52:in `run'
/usr/local/Cellar/cocoapods/1.8.4/libexec/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/usr/local/Cellar/cocoapods/1.8.4/libexec/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:52:in `run'
/usr/local/Cellar/cocoapods/1.8.4/libexec/gems/cocoapods-1.8.4/bin/pod:55:in `<top (required)>'
/usr/local/Cellar/cocoapods/1.8.4/libexec/bin/pod:23:in `load'
/usr/local/Cellar/cocoapods/1.8.4/libexec/bin/pod:23:in `<main>'

RuntimeError - Failed to download pods to merge

Hi, for some reason I cannot setup the plugin.
Here's my Gemfile:

source "https://rubygems.org"

gem "fastlane"
gem 'cocoapods'
gem 'cocoapods-pod-merge'

After this I've called bundle install then bundle exec pod install
When I add plugin 'cocoapods-pod-merge' to my Podfile I get error:

RuntimeError - Failed to download pods to merge
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.4/lib/cocoapods-pod-merge/Main.rb:223:in `block in merge'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.4/lib/cocoapods-pod-merge/Main.rb:222:in `chdir'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.4/lib/cocoapods-pod-merge/Main.rb:222:in `merge'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.4/lib/cocoapods-pod-merge/Main.rb:68:in `block in begin'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.4/lib/cocoapods-pod-merge/Main.rb:67:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.4/lib/cocoapods-pod-merge/Main.rb:67:in `begin'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-pod-merge-0.0.4/lib/cocoapods_plugin.rb:8:in `block in <module:CocoapodsPodMerge>'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/hooks_manager.rb:124:in `block (3 levels) in run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/hooks_manager.rb:116:in `block (2 levels) in run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/hooks_manager.rb:115:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/hooks_manager.rb:115:in `block in run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/hooks_manager.rb:114:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:599:in `run_plugins_pre_install_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:220:in `block in prepare'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:216:in `prepare'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:155:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/cli/exec.rb:74:in `load'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/cli/exec.rb:74:in `kernel_load'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/cli/exec.rb:28:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/cli.rb:463:in `exec'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/cli.rb:27:in `dispatch'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/cli.rb:18:in `start'
/Library/Ruby/Gems/2.6.0/gems/bundler-1.17.2/exe/bundle:30:in `block in <top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/Library/Ruby/Gems/2.6.0/gems/bundler-1.17.2/exe/bundle:22:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'

warm launch stats

Would be nice to see warm launch stats, cold launches are not useful.

`force_encoding': can't modify frozen String: "Failed to download pods to merge" (FrozenError)

-command: bundle exec pod install
-operating system:macOS 12.0.1

Gemfile,I only modify 'gem 'cocoapods', '1.11.2''

I use demo to execute 'bundle exec pod install'.
RuntimeError - Failed to download pods to merge
Failed to download pods to merge (RuntimeError)
11: from /Users/xxx/.rvm/gems/ruby-2.7.2/bin/ruby_executable_hooks:22:in <main>' 10: from /Users/xxx/.rvm/gems/ruby-2.7.2/bin/ruby_executable_hooks:22:in eval'
9: from /Users/xxx/.rvm/rubies/ruby-2.7.2/bin/pod:23:in <main>' 8: from /Users/xxx/.rvm/rubies/ruby-2.7.2/bin/pod:23:in load'
7: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.2/bin/pod:55:in <top (required)>' 6: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in run'
5: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/claide-1.0.3/lib/claide/command.rb:324:in run' 4: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/claide-1.0.3/lib/claide/command.rb:337:in rescue in run'
3: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/claide-1.0.3/lib/claide/command.rb:396:in handle_exception' 2: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:66:in report_error'
1: from /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface/error_report.rb:34:in report' /Users/xxx/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface/error_report.rb:34:in force_encoding': can't modify frozen String: "Failed to download pods to merge" (FrozenError)

Support multiple level dependance

Hi, we have pod structure as below:

ModuleA.podspec
s.dependency 'AFNetworking'

MergeFile:

group 'Networking' has_dependencies! pod 'AFNetworking' pod 'CustomNetwork', :path => "../../../path" end

Podfile

target 'target' do
pod 'Networking', :path => 'MergedPods/Networking'
pod 'ModuleA'
end

After run 'bundle exec pod install'
I got two AFNetworking in pod project.
One is under Development Pods, another is under Pods, how to solve it?

Deployment Target needs to be merged to highest common target

I experimented a bit with this plugin and when merging the pods BonMot and SnapKit the deployment target is set to 8.0 even though the pod BonMot only supports 9.0 and this results in SDK availability errors.

Example project: https://github.com/KaiOelfke/MergeTest

Either the MergeFile should specify a deployment target per group, take the deployment target from the Podfile or just automatically set it to the highest common target (in this case 9.0)

Also Podfile supports comments with # and strings with double quotes "" and MergeFile doesn't which would have saved me some time, if it would be mentioned in the documentation.

Otherwise it's a good idea. The launch time of the app I was experimenting with is improving quite a bit. Thanks for your work!

Podfile.lock version ignored on initial install

I was testing out this plugin and noticed that it upgraded a library when I first tried it out. It ignored the version in our Podfile.lock and instead installed the highest compatible version matching the version in the Podfile (we have '~> 5.2.0' in the Podfile, 5.2.5 in Podfile.lock and this plugin used 5.2.7

The bundle file is lost after merging

My configuration MergeFile is like this:
group 'UI'
pod 'MBProgressHUD', '> 1.1.0'
pod 'DZNEmptyDataSet', '
> 1.8.1'
pod 'MJRefresh', '> 3.2.2'
pod 'VTMagic', '
> 1.2.4'
pod 'BRPickerView', '> 2.7.3'
pod 'QMUIKit', '
> 4.2.3'
end
The bundle file of the 'BRPickerView' component is not added to the Pod after merging:
v消息20220811-204712

[bug] missing gem when run bundle exec pod install

I had ran 'bundle install to install all the gems', and then I run this command as below:
'bundle install'

and then it displayed the error "missing gems"

System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin21/rbconfig.rb:230: warning: Insecure world writable dir /opt/homebrew/opt in PATH, mode 040777 Could not find fastlane-2.206.2, cocoapods-pod-merge-0.0.4, artifactory-3.0.15, aws-sdk-s3-1.114.0, babosa-1.0.4, colored-1.2, commander-4.6.0, dotenv-2.7.6, emoji_regex-3.2.3, excon-0.92.3, faraday-1.10.0, faraday-cookie_jar-0.0.7, faraday_middleware-1.2.0, fastimage-2.2.6, google-apis-androidpublisher_v3-0.22.0, google-apis-playcustomapp_v1-0.8.0, google-cloud-storage-1.36.2, highline-2.0.3, json-2.6.2, jwt-2.4.1, mini_magick-4.11.0, multipart-post-2.0.0, naturally-2.2.1, optparse-0.1.1, plist-3.6.0, rubyzip-2.3.2, security-0.1.3, simctl-1.6.8, terminal-notifier-2.0.0, terminal-table-1.8.0, tty-screen-0.8.1, tty-spinner-0.9.3, word_wrap-1.0.0, xcpretty-0.3.0, xcpretty-travis-formatter-1.0.1, public_suffix-4.0.7, aws-sdk-core-3.131.1, aws-sdk-kms-1.57.0, aws-sigv4-1.5.0, faraday-em_http-1.0.0, faraday-em_synchrony-1.0.0, faraday-excon-1.1.0, faraday-httpclient-1.0.1, faraday-multipart-1.0.4, faraday-net_http-1.0.1, faraday-net_http_persistent-1.2.0, faraday-patron-1.0.0, faraday-rack-1.0.0, faraday-retry-1.0.3, http-cookie-1.0.5, google-apis-core-0.6.0, digest-crc-0.6.4, google-apis-iamcredentials_v1-0.11.0, google-apis-storage_v1-0.15.0, google-cloud-core-1.6.0, googleauth-1.1.3, mini_mime-1.1.2, unicode-display_width-1.8.0, tty-cursor-0.7.1, rouge-2.0.7, aws-eventstream-1.2.0, aws-partitions-1.598.0, jmespath-1.6.1, domain_name-0.5.20190701, representable-3.2.0, retriable-3.1.2, webrick-1.7.0, google-cloud-env-1.6.0, google-cloud-errors-1.2.0, memoist-0.16.2, multi_json-1.15.0, os-1.1.4, signet-0.16.1, unf-0.1.4, declarative-0.0.20, trailblazer-option-0.1.2, uber-0.1.0, unf_ext-0.0.8.2 in any of the sources Run bundle install to install missing gems.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.