X Tutup
Skip to content

build(broccoli): add tree-stabilizer plugin to deal with unstable trees#2143

Merged
IgorMinar merged 7 commits intoangular:masterfrom
IgorMinar:stabilize-trees
May 28, 2015
Merged

build(broccoli): add tree-stabilizer plugin to deal with unstable trees#2143
IgorMinar merged 7 commits intoangular:masterfrom
IgorMinar:stabilize-trees

Conversation

@IgorMinar
Copy link
Copy Markdown
Contributor

Previously we assumed that all input and ouput paths for broccoli trees are immutable, that turned out to be
incorrect.

By adding a tree stabilizer plugin in front of each diffing plugin, we ensure that the input trees
are stable. The stabilization is done via symlinks which is super cheap on platforms that support
symlinks. On Windows we currently copy the whole input directory, which is far from ideal. We should
investagate if using move operation on Windows is ok in the future to improve performance.

Closes #2051

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

rmdirSync will fail if non-empty, which it probably is. use rimraf or fs-extra instead?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, (using rimraf), if outputPath is a symlink of inputPath, isn't that going to remove everything in the inputPath? That seems like a not good thing to happen

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

FYI: Calling rimraf (or fs-extra, which calls rimraf) on a symlink will only remove the symlink, not descend into the target directory.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@caitp unless there is a bug in the system, we can't get into a situation where the underlying directory doesn't exist. output path is created by broccoli builder for each rebuild unless it already exists.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That doesn't address what my comment is saying. "rmdirSync" will fail (read: throw) if the directory is non-empty. We aren't talking about whether it exists or not, we're talking about it being non-empty, which it probably is. This most likely works correctly on unix systems where symlinkOrCopy is not copying, but on windows machines it's likely to break

@caitp
Copy link
Copy Markdown
Contributor

caitp commented May 25, 2015

For the record, I think we see better perf on win32 by avoiding the deep copy and just dealing with the property changing. Deep copy could be quite expensive in some cases

@caitp
Copy link
Copy Markdown
Contributor

caitp commented May 25, 2015

Another option is to just re-initialize the wrapped plugin if the inputPath(s) change, so you still get to keep your happy lifecycle management, without having to do unnecessary copying

@IgorMinar
Copy link
Copy Markdown
Contributor Author

@caitp we can't re-init the plugin as that would kill the incremental build.

IgorMinar added 7 commits May 28, 2015 11:44
Previously we assumed that all input and ouput paths for broccoli trees are immutable, that turned out to be
incorrect.

By adding a tree stabilizer plugin in front of each diffing plugin, we ensure that the input trees
are stable. The stabilization is done via symlinks which is super cheap on platforms that support
symlinks. On Windows we currently copy the whole input directory, which is far from ideal. We should
investagate if using move operation on Windows is ok in the future to improve performance.

Closes angular#2051
…than inputPath

Usually we don't care what we are diffing, but why we are diffing it. With this change we see what is causing build slowdown
due to diffing.
@IgorMinar IgorMinar merged commit b144174 into angular:master May 28, 2015
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DiffingPluginWrapper should handle input trees with mutable input paths

5 participants

X Tutup