feat(foundryup): add a --jobs
flag while building from source
#8021
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
I needed to build foundry from an active PR. The build failed repeatedly on my machine due to overruns on system resources.
(Process expanded to eat all ram, eventual build failures or system crashes. Ubuntu 22, 16GB ram, for what it's worth).
Solution
I added a
--jobs
flag to foundryup, which is passed to thecargo build
command. This is effectively a throttle on the build process. My local build worked fine after specifying-j 2
. With no flag, foundryup usesnproc
to recover the prior default behaviour of using all available CPUs.Also, I clarified the
usage
string to indicate commands that build from source vs installing via compiled binaries.