Skip to content

Having two plugins with Podfiles and a postinstall script fails with tns 5.x#3935

Merged
rosen-vladimirov merged 2 commits into
masterfrom
fix-postinstall-script
Sep 26, 2018
Merged

Having two plugins with Podfiles and a postinstall script fails with tns 5.x#3935
rosen-vladimirov merged 2 commits into
masterfrom
fix-postinstall-script

Conversation

@EddyVerbruggen
Copy link
Copy Markdown
Contributor

@EddyVerbruggen EddyVerbruggen commented Sep 25, 2018

With NativeScript 5.0.0-2018-09-25-12302 having fi. nativescript-plugin-firebase and nativescript-imagepicker in your project will fail because there's some whitespace missing.

Building this app fails because this is how the Pods are merged (mind the line # End Podfilepost_install near the end):

use_frameworks!

target "demong" do
# Begin Podfile - /Users/eddyverbruggen/sandboxes/nativescript-plugin-firebase/demo-ng/node_modules/nativescript-plugin-firebase/platforms/ios/Podfile
pod 'Firebase/Core', '~> 5.6.0' 

# Authentication
pod 'Firebase/Auth'

# Realtime DB
#pod 'Firebase/Database'

# Cloud Firestore
pod 'Firebase/Firestore'

# Remote Config
#pod 'Firebase/RemoteConfig'

# Crash Reporting
#pod 'Firebase/Crash'

# Crashlytics
pod 'Fabric'
pod 'Crashlytics'

# Crashlytics works best without bitcode
def post_installnativescript_plugin_firebase_0 (installer)
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ENABLE_BITCODE'] = "NO"
            config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = "YES"
        end
    end
end

# Firebase Cloud Messaging (FCM)
#pod 'Firebase/Messaging'

# Firebase Cloud Storage
#pod 'Firebase/Storage'

# Firebase Cloud Functions
#pod 'Firebase/Functions'

# AdMob
#pod 'Firebase/AdMob'

# Invites
#pod 'Firebase/Invites'

# Dynamic Links
#pod 'Firebase/DynamicLinks'

# ML Kit
pod 'Firebase/MLVision'
pod 'Firebase/MLVisionTextModel'
pod 'Firebase/MLVisionBarcodeModel'
pod 'Firebase/MLVisionFaceModel'
pod 'Firebase/MLVisionLabelModel'
pod 'Firebase/MLModelInterpreter'

# Facebook Authentication
#pod 'FBSDKCoreKit'
#pod 'FBSDKLoginKit'

# Google Authentication
#pod 'GoogleSignIn'
# End Podfile

# Begin Podfile - /Users/eddyverbruggen/sandboxes/nativescript-plugin-firebase/demo-ng/node_modules/nativescript-imagepicker/platforms/ios/Podfile
pod 'QBImagePickerController', '~> 3.4.0'
# End Podfilepost_install do |installer|
  post_installnativescript_plugin_firebase_0 installer
end
end

So let's add some whitespace in the line # End Podfilepost_install (this fix), so they are merged like this:

use_frameworks!

target "demong" do
# Begin Podfile - /Users/eddyverbruggen/sandboxes/nativescript-plugin-firebase/demo-ng/node_modules/nativescript-plugin-firebase/platforms/ios/Podfile
pod 'Firebase/Core', '~> 5.6.0' 

# Authentication
pod 'Firebase/Auth'

# Realtime DB
#pod 'Firebase/Database'

# Cloud Firestore
pod 'Firebase/Firestore'

# Remote Config
#pod 'Firebase/RemoteConfig'

# Crash Reporting
#pod 'Firebase/Crash'

# Crashlytics
pod 'Fabric'
pod 'Crashlytics'

# Crashlytics works best without bitcode
def post_installnativescript_plugin_firebase_0 (installer)
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ENABLE_BITCODE'] = "NO"
            config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = "YES"
        end
    end
end

# Firebase Cloud Messaging (FCM)
#pod 'Firebase/Messaging'

# Firebase Cloud Storage
#pod 'Firebase/Storage'

# Firebase Cloud Functions
#pod 'Firebase/Functions'

# AdMob
#pod 'Firebase/AdMob'

# Invites
#pod 'Firebase/Invites'

# Dynamic Links
#pod 'Firebase/DynamicLinks'

# ML Kit
pod 'Firebase/MLVision'
pod 'Firebase/MLVisionTextModel'
pod 'Firebase/MLVisionBarcodeModel'
pod 'Firebase/MLVisionFaceModel'
pod 'Firebase/MLVisionLabelModel'
pod 'Firebase/MLModelInterpreter'

# Facebook Authentication
#pod 'FBSDKCoreKit'
#pod 'FBSDKLoginKit'

# Google Authentication
#pod 'GoogleSignIn'
# End Podfile

# Begin Podfile - /Users/eddyverbruggen/sandboxes/nativescript-plugin-firebase/demo-ng/node_modules/nativescript-imagepicker/platforms/ios/Podfile
pod 'QBImagePickerController', '~> 3.4.0'
# End Podfile

post_install do |installer|
  post_installnativescript_plugin_firebase_0 installer
end
end

For the time being I've locally patched ~/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/services/cocoapods-service.js.

With NativeScript 5.0.0-2018-09-25-12302 having nativescript-plugin-firebase and nativescript-imagepicker in your project will fail because there's some whitespace missing.
@rosen-vladimirov
Copy link
Copy Markdown
Contributor

Hey @EddyVerbruggen ,
Thanks for this PR. Can you please fix the unit tests and if possible, add a new test for the mentioned scenario that's been failing on your side? You can check the failing tests in the Travis build. You can run the tests locally by executing grunt test ( I recommend you to place describe.only on the cocoapods tests that you'll have to deal with, this way only they will be executed).
Ping me in case you need help with the tests.

@mpochron
Copy link
Copy Markdown

run ci

@EddyVerbruggen
Copy link
Copy Markdown
Contributor Author

Hi @rosen-vladimirov, I've fixed the tests (sorry, didn't think of them) by changing to a better implementation.

I also tried adding a specific testcase for this issue but didn't get it working in a decent amount of time.

@rosen-vladimirov
Copy link
Copy Markdown
Contributor

Hey @EddyVerbruggen ,
Thanks for the fix, I'll take care to add a unit test in a separate PR.

@rosen-vladimirov rosen-vladimirov merged commit ccfce12 into master Sep 26, 2018
@rosen-vladimirov rosen-vladimirov deleted the fix-postinstall-script branch September 26, 2018 14:03
@EddyVerbruggen
Copy link
Copy Markdown
Contributor Author

AWESOME!

rosen-vladimirov added a commit that referenced this pull request Sep 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants