blakgeek / cordova-plugin-cocoapods-support

A Cordova/PhoneGap plugin to add support for CocoaPods dependencies.
MIT License
72 stars 71 forks source link

Using the plugin to add post_install code to the pod file #46

Closed guylando closed 5 years ago

guylando commented 5 years ago

How can we use the plugin to add post_install code to the pod file? Example desired script: https://github.com/twitter/twitter-kit-ios/issues/18#issuecomment-432633038 Example location inside podfile in the second example here: https://guides.cocoapods.org/syntax/podfile.html

guylando commented 5 years ago

This can be fixed using cordova hook since this plugin modified Podfile on after_prepare so the hook adding the post_install should be registered for before_build for example.

blakgeek commented 5 years ago

Can you let me know exactly what you did to address the issue? I'd like to add it the README.

On Sat, Mar 2, 2019 at 6:50 AM Guy Lando notifications@github.com wrote:

Closed #46 https://github.com/blakgeek/cordova-plugin-cocoapods-support/issues/46.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/blakgeek/cordova-plugin-cocoapods-support/issues/46#event-2175729857, or mute the thread https://github.com/notifications/unsubscribe-auth/AAyU3nesMIFsQdpaK4rI2H8Q0ou_GBCyks5vSmVygaJpZM4baHLU .

-- Get TagIt4Me https://ti4.me/app and earn free gift cards for helping shoppers find what they want.

guylando commented 5 years ago

@blakgeek

  1. The best thing in my opinion for this plugin is to add support to existing Podfile from the cordova root folder. The parsing can be done using: https://github.com/apache/cordova-ios/blob/master/bin/templates/scripts/cordova/lib/Podfile.js because currently this plugin overrides Podfile and doesn't support existing Podfile.

  2. In case no change in the plugin will be performed then since this plugin performs everything in the cordova hook after_prepare event creating the Podfile then, someone who will want to edit the Podfile should create a cordova before_build hook script where he will check if his changes were already done and if not then to do them to the Podfile (because this plugin does not always modify Podfile in case no pods were specified so to prevent in such cases from the changes such as install_script to be added twice or more).

  3. As can be seen by the link in (1) and release notes of cordova-ios, the newer versions added support for cocoa pods. I personally in the end solved my problem by modifying the problematic twitter plugin itself and I removed this plugin since its original purpose no longer is needed if cordova-ios added cocoa pods support built-in.