Skip to content

each file change triggers an endless build #2482

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

Closed
DavyDeDurpel opened this issue Feb 3, 2017 · 26 comments
Closed

each file change triggers an endless build #2482

DavyDeDurpel opened this issue Feb 3, 2017 · 26 comments
Assignees
Labels

Comments

@DavyDeDurpel
Copy link

I upgraded the cli from 2.4 to 2.5 and now every file changes triggers a build process that never stops. When the build is done a new build is started and this goes on forever. I already installed the @next version of the CLI but it has the same issue. I'm having this issue on windows with an android platform.

I downgraded to 2.4 and everything works as before. Though this can only be a temporary solution for me as I already upgraded the VS Code Nativescript extension to 0.6.0 and that one needs the 2.5 CLI and there's no option foreseen in VS Code to downgrade extensions.

Is there a way for me to find out what triggers the rebuild?
Can you also tell me why the 'livesync' feature has been removed? With 2.4 if I change a file it takes about 3 seconds on my machine to restart the application. As of 2.5 a complete rebuild is triggered each time and that takes about 2 minutes on my machine. Needless to say that this is a big step backwards.

@Plamen5kov
Copy link
Contributor

Hi @DavyDeDurpel, could you provide steps to reproduce the problem so we can try and figure out what's broken. Please paste the content of your <project_name>/package.json if possible.

@Plamen5kov Plamen5kov self-assigned this Feb 3, 2017
@DavyDeDurpel
Copy link
Author

I tried to simulate the issue with the HelloWorld example but it seems I encountered another issue. This is what I did:

  • install the 2.4.0 CLI
  • install the HelloWorld example
  • copy my package.json file
  • tns update
  • livesync with watch
    => any file changes are picked up and the application gets refreshed
  • install the 2.5.0 CLI
  • run android
    => all the messages that are logged seem to indicate that everything runs well except for the fact that the application does not get started on the android simulator. I also noticed that the 2.5.0 CLI launches a different simulator than the 2.4.0 CLI (I have 3 different simulators in my setup). The simulator in this case is an api23 64 bit image.
  • tns update
    => still the same issue. The app is installed on my emulator but it does open automatically.
  • open HelloWorld app manually
  • modify something
    => cli detects changes and says that the app is successfully synced but the app does not reload and the change is not visible
  • delete HelloWorld
  • recreate HelloWorld
  • copy my package.json
  • tns update
  • run android
    => application gets started correctly
  • modify code
    => change is picked up immediately

So the conclusion of these tests is that applications that are created with and older version of the CLI don't migrate well when updating the CLI to 2.5.0.

I will now try to recreate my application by using the 2.5.0 CLI and copy my code into it. I will let you know today or somewhere the beginning of next week if this fixes the issue.

package.json.txt

@DavyDeDurpel
Copy link
Author

I just finished with the recreation of my application and sadly it doesn't solve my issue. As soon as I modify a file and endless rebuilt is done.

This is what I did:

  • tns create
  • copied my old package.json
  • tns update
  • modified the build.gradle in the android platform needed for the push notifications plugin
  • replaced the 'app' directory with the old one
  • tns run android (2x as the first time I got the famous timeout)

I already tried removing the push notification stuff but that doesn't fix it. I did notice however that an earlier update removed the .map files and the .js files now how inline map info. Not sure if this could be related. Btw, I'm using Typescript 2.1.5.

This is what is logged whenever I modify a file:

2:38:53 PM - File change detected. Starting incremental compilation...
2:38:56 PM - Compilation complete. Watching for file changes.
Executing before-prepare hook from C:\ns\passerelle-mobile\hooks\before-prepare\nativescript-dev-android-snapshot.js
Executing before-prepare hook from C:\ns\passerelle-mobile\hooks\before-prepare\nativescript-dev-typescript.js
Preparing project...

And then the complete logging for the full compilation until the application is installed and than it starts all over again.

Installing...
Successfully installed on device with identifier 'emulator-5554'.
Refreshing application...
Successfully synced application com.passerelle.mobile on device emulator-5554.
Executing before-prepare hook from C:\ns\passerelle-mobile\hooks\before-prepare\nativescript-dev-android-snapshot.js
Executing before-prepare hook from C:\ns\passerelle-mobile\hooks\before-prepare\nativescript-dev-typescript.js
Preparing project...

@lukashlobil
Copy link

I can second that, after update to 2.5.0 I make one change to a file and it triggers endless cycle of builds. Using Webstorm as IDE.

@petekanev petekanev self-assigned this Feb 6, 2017
@Plamen5kov
Copy link
Contributor

@DavyDeDurpel without the google-services.json i can't reproduce your scenario. Although I might have and idea how to recreate the issue It would be best that I have the exact steps to reproduce the issue, so could you please post the contnent of google-services.json file.

@DavyDeDurpel
Copy link
Author

I can't just copy/paste the contents in here as it contains sensitive information. Is there a way that I can provide it to you in private?

@Plamen5kov
Copy link
Contributor

@DavyDeDurpel sure, write to me on my mail [email protected]

@Plamen5kov
Copy link
Contributor

@lukashlobil can you provide simpler steps to reproduce?

@Plamen5kov
Copy link
Contributor

Plamen5kov commented Feb 7, 2017

@DavyDeDurpel I received the json, and managed to build the project with no problems, so I can't reproduce neither the timeout nor the endless restart loop.

@DavyDeDurpel
Copy link
Author

I found it. It's the nativescript-i18n plugin that triggers the endless loop. I removed it completely from my application and now it behaves normally. I saw the light when I noticed that the nativescript-i18n hooks were executed when saving a modified file.

Most likely it's related to the fact that this plugin does some magic with the strings.xml files in the App_Resources folder.
They add an after-prepare hook: nativescript-i18n/lib/after-prepare.js

How do we continue? Do I close this issue and create a new one in the nativescript-i18n group?

@lukashlobil Can you confirm that you also use that specific plugin?

@lukashlobil
Copy link

I tried reproducing on new repo, but failed.
@DavyDeDurpel I confirm I also have this plugin installed

@DavyDeDurpel
Copy link
Author

I have logged the issue in nativescript-i18n:

EddyVerbruggen/nativescript-i18n#37

@Plamen5kov
Copy link
Contributor

@DavyDeDurpel @lukashlobil thank you, I'll investigate the nativescript-i18n plugin to find out what exactly is the issue.

@rborn
Copy link

rborn commented Feb 7, 2017

@Plamen5kov
I wonder if the cli should watch the files all the time or only after the prepare phase takes place.
This way the before-prepare hook can do whatever it has to do 😄

@DavyDeDurpel are you sure you have the last version of the plugin? because there is no after-prepare hook since 0.0.7

@petekanev
Copy link
Contributor

@rborn but... the prepare is triggered because there are file changes, transpilation being part of the prepare phase.

@rborn
Copy link

rborn commented Feb 7, 2017 via email

@rborn
Copy link

rborn commented Feb 8, 2017

@Plamen5kov @Pip3r4o I think I need your help guys, something is weird with 2.5.0 and I don't get what.
For example on ios the liveview tries to write in a place that doesn't exist:

Unable to sync files. Error is: cp: copyFileSync: could not write to dest file (code=ENOENT):/Users/Dan/Library/Developer/CoreSimulator/Devices/E5B28E3D-0A79-46CD-BF5C-387F20F45114/data/Containers/Bundle/Application/C5550E35-61D7-4EA4-A592-E70ADEC5E7AB/demo.app/Resources/Info.plist

But there is no "Resources" folder in the app

On android it complains that the xml files are corrupt - but the error is more like the files are not there (but they are)

Did anything changed in the way you load the hooks? Maybe there is a delay somewhere between the moment the hook is executed and the cli thinks the prepare phase is ready ?

Thank you

@Plamen5kov
Copy link
Contributor

@rborn please provide steps to reproduce and we'll figure it out.

@Plamen5kov Plamen5kov added the bug label Feb 8, 2017
@rborn
Copy link

rborn commented Feb 8, 2017

@Plamen5kov

Thank you very much 😄

@rborn
Copy link

rborn commented Feb 9, 2017

@Plamen5kov update - just got a PR that could fix this, I think it was me writing files async 😞
I'll come back to you as soon as I get the confirmation it works with typescript.
Sorry for the mess

@rborn
Copy link

rborn commented Feb 9, 2017

@Plamen5kov it seems that it's solved 😄 (there is a small issue but is not created by the CLI).

@DavyDeDurpel
Copy link
Author

I guess that we can close this one. Thanks to all for the collaboration!

@Plamen5kov
Copy link
Contributor

@rborn that's great

@elvismercado
Copy link

Guys, i've been redirected here from https://github.com/toddanglin/nativescript-dev-sass/issues/18#issuecomment-282133474.
I keep getting a second build of my app every time i make changes. After reading the comments here i still don't understand much what fixed the issue for you guys. Could you explain?

@rosen-vladimirov
Copy link
Contributor

Hey @elvismercado , please check the last comments here

@elvismercado
Copy link

thnx @rosen-vladimirov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants