Skip to content

Conversation

@mndeveci
Copy link
Contributor

@mndeveci mndeveci commented Jul 14, 2022

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.

@mndeveci mndeveci marked this pull request as ready for review July 17, 2022 21:49
Copy link
Contributor

@sriram-mv sriram-mv left a 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)
Copy link
Contributor

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?

Copy link
Contributor

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,
Copy link
Contributor

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?

Copy link
Contributor

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.

@mildaniel mildaniel merged commit 93c3518 into aws:develop Jul 25, 2022
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.

3 participants