Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smarter LiveSync #977

Closed
11 of 12 tasks
teobugslayer opened this issue Oct 22, 2015 · 22 comments
Closed
11 of 12 tasks

Smarter LiveSync #977

teobugslayer opened this issue Oct 22, 2015 · 22 comments

Comments

@teobugslayer
Copy link

Smarter LiveSync without restarts

  • CLI: Respect deleted files
  • CLI: When sending xml and css files to the device, do not restart the app
  • CLI: When syncing JS, images, fonts, or other resources - restart the entire app
  • CLI: Implement a dedicated tcp socket as communication channel between it and the runtimes
  • CLI: Notify runtimes after the files are on the device that the change had happened
  • CLI: Research if we can fast sync for other file types (mostly images)
  • CLI: Lower batch time in the cli to 250ms
  • CLI: Implement together batch livesync/restart with fast livesync

  • Android runtime: spike tcp socket as communication channel between it and the CLI.
  • Android: notify modules when files are changed and the current page must be reloaded - see bellow

  • iOS: notify modules when files are changed and the current page must be reloaded - see bellow

  • Modules: implement a global function (tentative name: __nativeScriptLiveSyncCallback). The run times will call it whenever the current page needs to be reloaded
@NathanaelA

This comment was marked as abuse.

@x4080
Copy link

x4080 commented Oct 23, 2015

I think Nathanael solution is pretty good in Android.the ios simulator version is already pretty fast, maybe Android is urgently need the update or just use Nathanael solution

@teobugslayer
Copy link
Author

Thank you for sharing your research about fonts! Did you verify this behavior on both iOS and Android?

Please bear in mind that this issue focuses only on the changes which we are introducing in NativeScript 1.5. We will continue improving LiveSync in the following releases. We need more time to discover and fix all the edge cases on both platforms.

There's a separate issue about linting. We think it is a very good idea and needs to be done at first opportunity.

@NathanaelA

This comment was marked as abuse.

@x4080
Copy link

x4080 commented Oct 23, 2015

And how about a feature to load script from http server? I think about for development and easy update for production purposes. It will be awesome

@kagha
Copy link

kagha commented Oct 26, 2015

Yes livesync from an HTTP server would be great for Native Script @x4080 @teobugslayer

This feature is a requirement of many projects I have coming up and is the only reason React Native is still an option for me. They already have the feature but I prefer Native Script for everything else.

The release of this feature I think would greatly improve Native Script's popularity because it enables devs to support customer deployments in a much faster and efficient way.

I am willing to contribute in any way I can to the expedition of the implementation of this feature.

@amjd
Copy link

amjd commented Nov 12, 2015

It would be awesome if support for console.log() is added in LiveSync mode too. Or any other way to debug apps while in LiveSync mode.

@vchimev vchimev added ready for test TSC needs to test this and confirm against live production apps and automated test suites severity: high feature labels Nov 16, 2015
@vchimev
Copy link
Contributor

vchimev commented Nov 23, 2015

Hi @amjd,

consoloe.log() will be supported with LiveSync in {N} version 1.5.0 (NativeScript/nativescript-cli#1130) for Android device/emulator and iOS device - iOS simulator will be added in the next versions.

@vchimev
Copy link
Contributor

vchimev commented Nov 23, 2015

Please refer to https://github.com/NativeScript/nativescript-cli/issues for any LiveSync related issues.

@vchimev vchimev added done and removed ready for test TSC needs to test this and confirm against live production apps and automated test suites labels Nov 23, 2015
@vchimev vchimev closed this as completed Nov 23, 2015
@toddanglin
Copy link

Are there any special requirements to make the new LiveSync work in {N} 1.5.0? I'm using the iOS Simulator and running tns livesync ios still causes the app to reload.

FWIW, the terminal shows this error when running livesync with the iOS simulator:
Unable to start service com.apple.mobile.house_arrest. Result code is: 3892314239

Simulator still loads fine, so not sure the implication of this error. Looked at trace logs, but few obvious errors there. Only error that occurs in logs before one above is this:

stderr: 
Transferring project files...
Transferring project files...
Multiple exceptions were thrown:
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:535:15)
...

@GitCharm
Copy link

Issue with Android- calling "tns livesync android" with my connected Android device and am getting the following error:

Project successfully prepared
Transferring project files...
spawn ENAMTOOLONG

Thanks in advance for assistance on this

@Fatme
Copy link
Contributor

Fatme commented Nov 25, 2015

Hi @toddanglin,

It seems that you have connected device and running simulator. In order to livesync to iOS simulator execute tns livesync ios --emulator command. If you change .xml or .css file the application will not restart but if you change .js file the application will restart.

@Fatme
Copy link
Contributor

Fatme commented Nov 25, 2015

Hi @GitCharm,

Can you execute tns livesync android --log trace and send us the produced log output.

@toddanglin
Copy link

Thanks, @Fatme. I actually don't have any other iOS devices physically connected...but tns device does show additional iOS devices. Not sure if that's bad caching of previously connected devices OR if somehow the devices are being detected over WiFi.

Either way, the tns livesync ios --emulator command eliminates the error, BUT...

The iOS simulator is still restarting every time I issue the livesync command. Here is the last part of the log trace when I run tns livesync ios --emulator:

Project successfully prepared
AfterHookName for command prepare is after-prepare
Exec ps cax | grep launchd_sim 
 stdout: 79938   ??  S      0:00.88 launchd_sim

 stderr: 
Exec killall icn 
 stdout:  
 stderr: 
Exec xcrun simctl launch 4232A8A4-DEE0-43BE-84EE-2A3B8F6161C3 com.htmlui.icn 
 stdout: com.htmlui.icn: 81945

 stderr:

Seems livesync is doing a killall every time I run it (regardless of what files do/don't change).

@ignaciofuentes
Copy link

I am having the same experience as @toddanglin

I can actually see the visual change right before the app restarts.
I suspect it's related to the typescript compilation step.

@vchimev
Copy link
Contributor

vchimev commented Nov 25, 2015

@toddanglin,
could you please make sure that you upgraded the tns-core-modules package in your app? If you open the package.json file of your app, under dependencies the record for tns-core-modules should point to 1.5.0.

@ignaciofuentes
Copy link

I just created a brand new hello world app and the smart livesync works just fine...
after running "tns install typescript" every XML/CSS change triggers a restart of the app. :(

@toddanglin
Copy link

@vchimev Yes, I can confirm that tns-core-modules has been upgraded to 1.5.0. In fact, I deleted the entire tns-core-modules directory and then let npm re-install the latest version to be sure all modules were 100% fresh/upgraded.

@ignaciofuentes That's interesting. To test, I created a brand new project and smart livesync still restarts the app with each update (no TypeScript). I'm testing against iOS simulator on OS X.

@chrisbarry
Copy link

chrisbarry commented May 31, 2016

At the moment, I'm seeing a pretty poor livesync experience with ios. The app fully restarts, and requires a 5-10 second reload time, losing state in the process.

I'm not 100% sure, but due to the existence of this project https://github.com/NathanaelA/nativescript-liveedit and that React Native seems to have a lot swifter reloading, is this something that NativeScript is going to be pushing to achieve (ie hot reloading of as much of the app as possible, without a full rebuild/restart, particularly for JS / logic files)?

@toddanglin
Copy link

@chrisbarry Sorry to hear you're having that much trouble. Not normally the livesync experience.

That said, the 2.1 release is aiming to make hot reloading in NativeScript even more robust/faster. Definitely something the core team is continuing to invest a lot of time in improving. You can see it on the high-level roadmap here: https://www.nativescript.org/roadmap

The goal is to support the hot reloading experience you describe: fast, reload all assets, retain state

@chrisbarry
Copy link

@toddanglin many thanks for the response, NativeScript does seem to be one of the cleanest cross platform tools available today.

2.1 sounds exciting, looking forward to trying that out once it's ready!

@lock
Copy link

lock bot commented Aug 30, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Aug 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests