-
Notifications
You must be signed in to change notification settings - Fork 152
feat: use symlink instead of copy for some build operations #374
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
Conversation
sriram-mv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions.
| "Symlink operation is failed, falling back to copying files", | ||
| exc_info=ex if LOG.isEnabledFor(logging.DEBUG) else None, | ||
| ) | ||
| copytree(source, destination) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I right that this is backwards compatible, in the sense that if we cannot symlink we fall back to copying which was the existing behavior anyways?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's correct.
| # Auto dependency layer disabled, first build | ||
| actions += [esbuild_with_deps, CopyDependenciesAction(source_dir, scratch_dir, self.dependencies_dir)] | ||
| actions += [ | ||
| esbuild_with_deps, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this require an experimental check? Python requires it and node es build does not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a conscious decision. Since is esbuild is still in beta, we figured it would be redundant to have two beta flags for it.
Companion PR to this: aws/aws-sam-cli#3935
Related Issues
aws/aws-sam-cli#3093
aws/aws-sam-cli#2688
Description of changes:
During the incremental build, we do an extra copy operation to persist dependencies into a different folder so that next time the build can re-use them instead of re-downloading if the manifest file has not changed.
But that extra copy operation might take some time especially for a build where there are a lot of small files.
This PR addresses this issue by replacing copy operation with symlink, since symlinking those files will be faster than copying them.
Note: This improvement can't be applied to regular nodejs build & ruby build yet since local invocation for these runtimes will be broken.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.