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

fix: hash plugin files after prepare #5753

Merged

Conversation

mukaschultze
Copy link
Contributor

@mukaschultze mukaschultze commented Aug 10, 2023

PR Checklist

What is the current behavior?

NativeScript CLI hashes plugin files before preparing them, meaning that the next run of the CLI will have outdated hashes if the plugin changed any of its files during the prepare step.

This can lead to some cases of plugins not being prepared when they should because the known hashes (from .ns-plugins-build-data.json) match the hashes of a plugin that was not built yet.

This is notable when using yarn and some plugins from nativescript-community (i.e. ui-lottie and ui-material-*) because they don't ship a .aar in the tarball. After installing any dependency with yarn it'll reset the node_modules to a known state that will break the known hashes of the CLI.

Steps to reproduce:

git clone https://github.com/nativescript-community/ui-lottie.git
cd demo
yarn # not reproducible with npm unless manually messing with node_modules
ns run android
yarn add uuid # any package woks here, using uuid as example
ns run android # app crashes due to missing aar file

What is the new behavior?

The CLI now hashes the plugin files after a successful prepare, meaning that it'll store the most recent file hashes for plugins that change their contents during this step.

A side-effect of this fix is that the CLI tracks more accurately which plugins need to be prepared after a yarn install even if they do ship their own .aar files as it now has a way for checking if the shipped .aar has the same hashes as the one previous compiled locally.

@rigor789 rigor789 merged commit ecf1959 into NativeScript:main Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants