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: Skip preparation of plugins native files in case they are not changed #3768

Merged
merged 2 commits into from
Jul 24, 2018

Conversation

rosen-vladimirov
Copy link
Contributor

Skip the preparation of plugins' native files in case there's no change of the files since last operation when the files have been prepared.
Do this by using hash sums of files in each plugin's platforms/<platform> dir in case such exists. This way, in case you apply a change outside of the <plugin dir>/platforms/<platform> dir, the plugin's native files will not be prepared again. This way application will not be rebuilt as there's no need to do this.

chore: Add logging in projectChangesService

Add logging in projectChangesService's checkForChanges method in order to know which files are changed. This will help us to understand why prepare is triggered.

PR Checklist

What is the current behavior?

Whenever a change in node_modules is detected, CLI prepares the native resources. For example this leads to regeneration of Podfile whenever a change in .js or even .css inside node_modules is detected.

What is the new behavior?

CLI persists shasums for each plugin's native part. In case the plugin's native part is not changed, CLI will not prepare the native resources of the plugin itself.

Partial fix for #3549

Add logging in projectChangesService's checkForChanges method in order to know which files are changed. This will help us to understand why prepare is triggered.
@rosen-vladimirov rosen-vladimirov added this to the 4.2.0 milestone Jul 23, 2018
@rosen-vladimirov rosen-vladimirov self-assigned this Jul 23, 2018
@rosen-vladimirov rosen-vladimirov force-pushed the vladimirov/checkForChanges-logging branch 2 times, most recently from ef0070f to 92cf983 Compare July 23, 2018 18:19
this._changesInfo.modulesChanged = true;
}
if (this._changesInfo.modulesChanged || this._changesInfo.appResourcesChanged) {
this.$logger.trace(`Set configChanged to true, current value of moduleChanged is: ${this._changesInfo.modulesChanged}, appResourcesChanged is: ${this._changesInfo.appResourcesChanged}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is better to print all changesInfo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is printed at the end of the method. Or you want to know the value of the properties before setting all of them to true?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I just want to see all changesInfo and didn't notice it is printed at the end of the method.

assert.deepEqual(testData.dataPassedToWriteJson, { [testData.pluginData.name]: newPluginHashes });
});

it("does not prepare the files when plugin has platforms dir and has files has not changed since then", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe
has files that are not changed since then?

Copy link
Contributor

@Fatme Fatme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After green build!

@rosen-vladimirov rosen-vladimirov force-pushed the vladimirov/checkForChanges-logging branch from 92cf983 to d159572 Compare July 23, 2018 23:17
…anged

Skip the preparation of plugins' native files in case there's no change of the files since last operation when the files have been prepared.
Do this by using hash sums of files in each plugin's `platforms/<platform>` dir in case such exists. This way, in case you apply a change outside of the `<plugin dir>/platforms/<platform>` dir, the plugin's native files will not be prepared again. This way application will not be rebuilt as there's no need to do this.
@Fatme Fatme merged commit d8e1dfb into master Jul 24, 2018
@Fatme Fatme deleted the vladimirov/checkForChanges-logging branch July 24, 2018 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants