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

Custom builder should not copy source files to temp folder #328

Closed
zhuhaow opened this issue Feb 11, 2022 · 4 comments
Closed

Custom builder should not copy source files to temp folder #328

zhuhaow opened this issue Feb 11, 2022 · 4 comments

Comments

@zhuhaow
Copy link

zhuhaow commented Feb 11, 2022

Currently, the custom builder would copy the whole source code in CodeUri to a temp folder and run make there, causing aws/aws-sam-cli#3371, aws/aws-sam-cli#3350, aws/aws-sam-cli#3093, aws/aws-sam-cli#2688, to name a few.

But consider this:

  1. The build process is already fully customized and all functions are built sequentially by default, the user can already control the building process so they won't need sam to provide a clean build env for them in ANY case. If they want to run the build in a new snapshot folder, they can do it themselves.
  2. There is no "clean" build env. The project folder always contains a lot of build artifacts, caches, and other stuff that we want to put into ".gitignore". By copying them, the temp build env is not really clean anyway, unless the user cleans them manually before running sam build, which leads to 3.
  3. If the project can not be built without a "clean" env, the user should clean the project in Makefile, the sam cannot do it for them anyway.

However, copying the source code not only takes a lot of time but makes incremental building almost impossible since the build happens in a temp folder.

I'm seconding aws/aws-sam-cli#2655, but it should not be a feature, but a bug to fix. We may need a flag to guard this change but that's only for backward compatibility and building without copy should be the default behavior.

@zhuhaow zhuhaow changed the title Custom maker should not copy source files to temp folder Custom builder should not copy source files to temp folder Feb 11, 2022
@mildaniel
Copy link
Contributor

Thanks @zhuhaow for bringing this up. I will bring up this issue with the team and create a ticket for us to keep track of this internally.

@zhuhaow
Copy link
Author

zhuhaow commented Mar 23, 2022

It would be awesome this can be improved. Currently, I’m maintaining my own fork which is a pain

@mndeveci
Copy link
Contributor

Thanks for the recommendation @zhuhaow

The request makes sense, but we still need to maintain backward compatibility. For that reason, this could be tied into a flag in SAM CLI so that it won't be using TMP folder everytime it builds.

I tagged this issue with so that our PMs can take a look at it.

@torresxb1
Copy link
Contributor

Closing so that we can track in the above issue (Feature request: Build in source). There's multiple open issues relating to similar problems, so we want to have a central place to track.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants