nativescript-cli: Podfile generation broken on livesync
Which platform(s) does your issue occur on?
iOS
Please provide the following version numbers that your issue occurs with:
- CLI: 4.0.0
- Cross-platform modules: 4.0.0
- Runtime(s): 4.0.1
- Plugin(s):
"nativescript-advanced-webview": "^1.1.3",
"nativescript-angular": "~5.3.0",
"nativescript-async": "^1.0.2",
"nativescript-bottombar": "^3.0.8",
"nativescript-directions": "^1.2.0",
"nativescript-drop-down": "^3.2.4",
"nativescript-floatingactionbutton": "^3.0.0",
"nativescript-geolocation": "^3.0.0",
"nativescript-google-maps-sdk": "^2.6.0",
"nativescript-gradient": "^2.0.1",
"nativescript-input-mask": "^1.0.0",
"nativescript-iqkeyboardmanager": "~1.1.0",
"nativescript-ng-shadow": "^2.0.0",
"nativescript-plugin-firebase": "^5.3.0",
"nativescript-pro-ui": "^3.3.0",
"nativescript-snackbar": "^2.0.0",
"nativescript-theme-core": "^1.0.4",
"nativescript-unit-test-runner": "^0.3.4",
Please tell us how to recreate the issue in as much detail as possible.
Running tns run ios --clean
with this configuration produces a working build, however any changes made to the code cause the Podfile to be rebuilt in a way that causes a recursion error.
Here is my Podfile (from platforms/ios
) after the initial build:
use_frameworks!
target "myproject" do
# Begin Podfile - /Users/vincecooley/Projects/myproject/node_modules/nativescript-bottombar/platforms/ios/Podfile
use_frameworks!
pod 'MiniTabBar', :git => 'https://github.com/rhanb/MiniTabBar.git'
def post_install1 (installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
# End Podfile
# Begin Podfile - /Users/vincecooley/Projects/myproject/node_modules/nativescript-floatingactionbutton/platforms/ios/Podfile
pod 'MNFloatingActionButton', '~> 0.1.5'
# End Podfile
# Begin Podfile - /Users/vincecooley/Projects/myproject/node_modules/nativescript-google-maps-sdk/platforms/ios/Podfile
source 'https://github.com/CocoaPods/Specs.git'
pod 'GoogleMaps'
# End Podfile
# Begin Podfile - /Users/vincecooley/Projects/myproject/node_modules/nativescript-input-mask/platforms/ios/Podfile
pod 'InputMask', :path => '~/Projects/input-mask-ios'
def post_install2 (installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
# End Podfile
# Begin Podfile - /Users/vincecooley/Projects/myproject/node_modules/nativescript-iqkeyboardmanager/platforms/ios/Podfile
pod 'IQKeyboardManager', '~> 4.0.0'
# End Podfile
# Begin Podfile - /Users/vincecooley/Projects/myproject/node_modules/nativescript-plugin-firebase/platforms/ios/Podfile
pod 'Firebase', '~> 4.11.0'
pod 'Firebase/Auth'
# Uncomment if you want to enable Realtime DB
pod 'Firebase/Database'
# Uncomment if you want to enable Cloud Firestore
pod 'Firebase/Firestore'
# Uncomment if you want to enable Remote Config
#pod 'Firebase/RemoteConfig'
# Uncomment if you want to enable Crash Reporting
#pod 'Firebase/Crash'
# Uncomment if you want to enable Crashlytics
pod 'Fabric'
pod 'Crashlytics'
# Crashlytics works best without bitcode
def post_install3 (installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = "NO"
end
end
end
# Uncomment if you want to enable FCM (Firebase Cloud Messaging)
#pod 'Firebase/Messaging'
# Uncomment if you want to enable Firebase Storage
#pod 'Firebase/Storage'
# Uncomment if you want to enable AdMob
#pod 'Firebase/AdMob'
# Uncomment if you want to enable Invites and/or Dynamic Links
#pod 'Firebase/Invites'
# Uncomment if you want to enable Facebook Authentication
#pod 'FBSDKCoreKit'
#pod 'FBSDKLoginKit'
# Uncomment if you want to enable Google Authentication
#pod 'GoogleSignIn'
# End Podfile
# Begin Podfile - /Users/vincecooley/Projects/myproject/node_modules/nativescript-snackbar/platforms/ios/Podfile
pod 'SSSnackbar', :git => 'https://github.com/EddyVerbruggen/SSSnackbar.git', :tag => '0.1.2.4'
# End Podfile
end
post_install do |installer|
post_install1 installer
post_install2 installer
post_install3 installer
end
And here is my Podfile after making a change within my application’s code. The problem occurs in the post_install1
method, which recursively calls itself, but the entire Podfile is mangled:
use_frameworks!
target "myproject" do
# Begin Podfile - /Users/vincecooley/Projects/myproject/node_modules/nativescript-bottombar/platforms/ios/Podfile
use_frameworks!
pod 'MiniTabBar', :git => 'https://github.com/rhanb/MiniTabBar.git'
def post_install1 (installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
# End Podfile
# Begin Podfile - /Users/vincecooley/Projects/myproject/node_modules/nativescript-floatingactionbutton/platforms/ios/Podfile
pod 'MNFloatingActionButton', '~> 0.1.5'
# End Podfile
# Begin Podfile - /Users/vincecooley/Projects/myproject/node_modules/nativescript-google-maps-sdk/platforms/ios/Podfile
source 'https://github.com/CocoaPods/Specs.git'
pod 'GoogleMaps'
# End Podfile
# Begin Podfile - /Users/vincecooley/Projects/myproject/node_modules/nativescript-input-mask/platforms/ios/Podfile
pod 'InputMask', :path => '~/Projects/input-mask-ios'
def post_install2 (installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
# End Podfile
# Begin Podfile - /Users/vincecooley/Projects/myproject/node_modules/nativescript-iqkeyboardmanager/platforms/ios/Podfile
pod 'IQKeyboardManager', '~> 4.0.0'
# End Podfile
# Begin Podfile - /Users/vincecooley/Projects/myproject/node_modules/nativescript-plugin-firebase/platforms/ios/Podfile
pod 'Firebase', '~> 4.11.0'
pod 'Firebase/Auth'
# Uncomment if you want to enable Realtime DB
pod 'Firebase/Database'
# Uncomment if you want to enable Cloud Firestore
pod 'Firebase/Firestore'
# Uncomment if you want to enable Remote Config
#pod 'Firebase/RemoteConfig'
# Uncomment if you want to enable Crash Reporting
#pod 'Firebase/Crash'
# Uncomment if you want to enable Crashlytics
pod 'Fabric'
pod 'Crashlytics'
# Crashlytics works best without bitcode
def post_install3 (installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = "NO"
end
end
end
# Uncomment if you want to enable FCM (Firebase Cloud Messaging)
#pod 'Firebase/Messaging'
# Uncomment if you want to enable Firebase Storage
#pod 'Firebase/Storage'
# Uncomment if you want to enable AdMob
#pod 'Firebase/AdMob'
# Uncomment if you want to enable Invites and/or Dynamic Links
#pod 'Firebase/Invites'
# Uncomment if you want to enable Facebook Authentication
#pod 'FBSDKCoreKit'
#pod 'FBSDKLoginKit'
# Uncomment if you want to enable Google Authentication
#pod 'GoogleSignIn'
# End Podfile
# Begin Podfile - /Users/vincecooley/Projects/myproject/node_modules/nativescript-snackbar/platforms/ios/Podfile
pod 'SSSnackbar', :git => 'https://github.com/EddyVerbruggen/SSSnackbar.git', :tag => '0.1.2.4'
# End Podfile
end
def post_install1 (installer)
post_install1 installer
post_install2 installer
post_install3 installer# Begin Podfile - /Users/vincecooley/Projects/myproject/node_modules/nativescript-bottombar/platforms/ios/Podfile
use_frameworks!
pod 'MiniTabBar', :git => 'https://github.com/rhanb/MiniTabBar.git'
def post_install2 (installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
# End Podfile
# Begin Podfile - /Users/vincecooley/Projects/myproject/node_modules/nativescript-input-mask/platforms/ios/Podfile
pod 'InputMask', :path => '~/Projects/input-mask-ios'
def post_install3 (installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
# End Podfile
# Begin Podfile - /Users/vincecooley/Projects/myproject/node_modules/nativescript-plugin-firebase/platforms/ios/Podfile
pod 'Firebase', '~> 4.11.0'
pod 'Firebase/Auth'
# Uncomment if you want to enable Realtime DB
pod 'Firebase/Database'
# Uncomment if you want to enable Cloud Firestore
pod 'Firebase/Firestore'
# Uncomment if you want to enable Remote Config
#pod 'Firebase/RemoteConfig'
# Uncomment if you want to enable Crash Reporting
#pod 'Firebase/Crash'
# Uncomment if you want to enable Crashlytics
pod 'Fabric'
pod 'Crashlytics'
# Crashlytics works best without bitcode
def post_install4 (installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = "NO"
end
end
end
# Uncomment if you want to enable FCM (Firebase Cloud Messaging)
#pod 'Firebase/Messaging'
# Uncomment if you want to enable Firebase Storage
#pod 'Firebase/Storage'
# Uncomment if you want to enable AdMob
#pod 'Firebase/AdMob'
# Uncomment if you want to enable Invites and/or Dynamic Links
#pod 'Firebase/Invites'
# Uncomment if you want to enable Facebook Authentication
#pod 'FBSDKCoreKit'
#pod 'FBSDKLoginKit'
# Uncomment if you want to enable Google Authentication
#pod 'GoogleSignIn'
# End Podfile
end
post_install do |installer|
post_install1 installer
post_install2 installer
post_install3 installer
post_install4 installer
end
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 6
- Comments: 19 (12 by maintainers)
Hey @rosen-vladimirov,
I can confirm
nativescript@next
is working for the project @NathanWalker has been referring too. Both with and without--syncAllFiles
.Thanks again. 😄
Hey @vcooley , the issue is in CLI when regenerating the Podfile and I’m working on a fix. We’ll do our best to release it in one of the next patches release of NativeScript CLI.
Hey guys,
I would like to share some details about this case, why it reappeared in master branch and what’s the current plan for the fix. The issue has been reported some time ago and at first we had some troubles reproducing it. After that we’ve successfully reproduced one case, but it seems to be caused by incorrect version of the
nativescript-input-mask
plugin. After some investigation, we confirmed there’s a problem with CLI regenerating Podfile when more than one plugin has a Podfile withpost_install
hook. However, we were still not sure what triggers the regeneration of Podfile - on theory it shouldn’t happen when thenode_modules
are not modified.Meanwhile we’ve received reports for similar issues for Android, where all plugins’
.aar
files have been rebuilt whenever there’s a change innode_modules
. All the reports included passing--bundle
flag to the build, so we’ve investigated this case particularly. At this point we did not have an idea what causes the unexpected regeneration of Podfile and rebuilding of.aar
files when they shouldn’t be rebuilt. After some investigation, we have found some issues when--bundle
flag is passed and these PRs should have fixed them: https://github.com/NativeScript/nativescript-cli/pull/3708/ and https://github.com/NativeScript/nativescript-cli/pull/3711 The second PR “fixed” the issues with.aar
and Podfile regeneration. However, we did not notice we’ve broken processing of any change innode_modules
- CLI was checking the state ofnode_modules
only if you pass--syncAllFiles
. This works fortns run
command, but it causes really strange and unexpected behavior when you run commands liketns build <platform>
ortns prepare <platform>
- the changes innode_modules
are never processed and moved to the device. So we had to deal with this case and this PR was born. The description contains all the details, but the most important part is that all CLI commands liketns prepare <platform>
,tns build <platform>
and the initial execution oftns run <platform>
(i.e. the first part of the execution of this command, not only the first time when you run it) will check the state ofnode_modules
and prepare the files from it in case it is necessary. The PR had a fix for rebuilding.aar
files only when the source files of the plugin had changed. However, we were unable to apply the same fix for iOS at this point. So that’s what caused the issue with Podfile regeneration to reappear in master branch.We have not stopped looking into this case, but the solution of the incorrect regeneration is not a simple one. Also, we were still not sure why the Podfile is regenerated on your side. After further investigation and by using the information provided by @NathanWalker , we were able to understand what’s happening - during development, Nathan is changing some files (like
.scss
,.ts
, etc.) in a linked plugin. CLI detects the change and as the plugin is innode_modules
, CLI decides to prepare thenode_modules
again. For iOS this includes regeneration of the Podfile. As the applied change is not in the<plugin dir>/platforms/ios/...
CLI should not regenerate the project’s Podfile in such case. And that’s exactly what this PR does. This PR will allow a development workflow where a change innode_modules
is applied and it is not inside plugin’s native part. Please note that CLI was not designed to support changes innode_modules
with such details, i.e. to understand if the plugin requires rebuild, etc. The current fixes allow such workflow and the whole approach could be considered as new feature for CLI. Anyway, the last PR will improve the workflow, but it will not fix the issue when multiple plugins have Podfiles withpost_install
hooks. In case you apply a change in any of the Podfiles of such plugins, CLI will still regenerate the project’s Podfile and it will again brake the project. In order to fix this, we have applied some complex changes, they are still on a branch as more tests must be added. You can give it a try by using the vladimirov/fix-podfile-issues-2 branch of NativeScript CLI. Currently it does not include the fixes from https://github.com/NativeScript/nativescript-cli/pull/3768 as this allows easier reproducing of the issue. The branch has a high regression potential, so we’ll be very careful before merging it.Please note that we have plans to merge https://github.com/NativeScript/nativescript-cli/pull/3768 and include it in 4.2.0 release. This should resolve your development workflow issues. The real fix for Podfile regeneration most probably will be included in the 4.2.1 release as it needs to be tested carefully.
Hope this clears the case. We’ve not stopped working and investigating this issue. The main problem we had is to understand why CLI decides to prepare
node_modules
again. In order to resolve such issues faster in the future, please share all details about your steps, what’s your exact workflow and where you apply changes in your source.Nice work @rosen-vladimirov 🙌 ❤️
The issue has surfaced again on iOS. disregard
next
- still an issue.I just want to make sure I understand correctly; and that you have covered a corner case that I have ran into on both iOS and Android… Since my case doesn’t have the
--bundle
flag attached to it…I use plain NativeScript for most my projects (not Vue or Angular). So I don’t use the
--bundle
command. However, if I am working on a plugin (which I’ve done several this month) for a client I will use the--syncAllFiles
on the demo app.I have noticed several times:
A TS, JS, CSS, XML file change will almost always rebuild the app if the plugin has a AAR, Podfile, or Gradle file, even if nothing changed in the plugins
platforms/
folder. (This rebuild eats a lot of time)A TS, JS, CSS, XML file change will occasionally rebuild the app on iOS even without a platforms/ios folder. Not sure the trigger; but occasionally it decides it want’s to rebuild it again, rather than just livesync’g the single changed file over. (This rebuild is just plain annoying!)
@rosen-vladimirov
Hey guys, we’ve investigated this issue and I confirm the unexpected behavior. It can be easily reproduced by executing the following commands:
We are working on a fix and I’ll write back once we have more information.
@rosen-vladimirov If you have a branch in progress perhaps could post it and reference this issue just so others can see movement here as it’s big issue affecting many at moment.