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

Feature request: Build in source #4571

Closed
torresxb1 opened this issue Jan 12, 2023 · 7 comments
Closed

Feature request: Build in source #4571

torresxb1 opened this issue Jan 12, 2023 · 7 comments
Assignees
Labels
type/feature Feature request

Comments

@torresxb1
Copy link
Contributor

torresxb1 commented Jan 12, 2023

Describe your idea/feature/enhancement

When building certain runtimes (Java, NodeJS, Python, Ruby, provided/custom), SAM CLI copies the source code and builds in another directory.

However, there are limitations with this approach, some of the main ones being:

  • local dependencies with relative paths
    • when we copy the source to another directory to build, relative paths are broken
    • example issue
  • build speed
    • the native ability of package managers or other tooling to do build caching and incremental builds can be lost when building in another directory
    • doing extra copy operations could be slow for big projects

Proposal

Adding an option to allow building directly in the source code directory instead.

Additional Details

Runtimes that already build directly in the source code directory: Go, .NET.

Related Issues:

@torresxb1 torresxb1 added the type/feature Feature request label Jan 12, 2023
@torresxb1 torresxb1 self-assigned this Jan 12, 2023
@torresxb1
Copy link
Contributor Author

torresxb1 commented Jan 12, 2023

We're currently working on this feature, prioritizing the provided/custom (Makefile) and NodeJS runtimes first.
We're also seeking feedback for the NodeJS implementation: #4537

@kirilgorbachov
Copy link

Hi @torresxb1, Are there any updates?

prioritizing the provided/custom (Makefile) and NodeJS runtimes first

Makefile is already supported, but it does not solve the problems that would be resolved by providing the capability to build in the source code directory. This coping should be optional.

@torresxb1
Copy link
Contributor Author

Hi @kirilgorbachov, we are still working on the implementation. I unfortunately can't give a timeline, but I will definitely post an update here once it's ready.

The option to build in the source code directory will certainly be optional and the current defaults will be maintained.

@jeremyplichtafc
Copy link

A pretty poor workaround for now could be to just change directory back to the original in the makefile and build it. Example with gradle (could be modified to golang or others)

build-SearchHandler:
	bash -c "cd ${OLDPWD} && gradle clean build && cp -rf ./build/classes/* $(ARTIFACTS_DIR)/"

@joshuat
Copy link

joshuat commented Jun 14, 2023

@kirilgorbachov can you elaborate on this - "Makefile is already supported"? I'm not seeing where building in the source directory is supported for Makefile runtimes.

Also @torresxb1 - is there any update you're able to share with us?

@lucashuy
Copy link
Contributor

lucashuy commented Dec 7, 2023

Hi all, sorry about the delay in responses. The good news is that building projects in source is now released as of SAM CLI v1.104.0! Build your Node.js projects (including esbuild building methods) and Makefile projects with the new --build-in-source flag for sam build and sam sync.

Closing this issue as complete, please feel free to create a new issue or feature request if you'd like to help improve SAM CLI.

@lucashuy lucashuy closed this as completed Dec 7, 2023
Copy link
Contributor

github-actions bot commented Dec 7, 2023

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature Feature request
Projects
None yet
Development

No branches or pull requests

5 participants