fix(pg): Avoid recompiling every single time we invoke the users script #1564
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.
Purpose
Fixes an issue reported by Sablier where the
Validating Networks...
step is taking an extremely long time to run.Context
Foundry recently implemented a change where the cache is disregarded if the build info file is requested. This causes a UX issue where if you have build_info = true in your foundry.toml file then the entire project is recompiled every single time you run a script/test/etc. This is obviously a terrible experience.
foundry-rs/foundry#7379
This causes our plugin to run extremely slow because the users entire project is recompiled every time we call into their script.
This PR makes the following changes to temporarily address the issue:
build_info = true
from our recommendedfoundry.toml
settingscompile
at the beginning of a script we compile with the--build-info
flag since the rest of our logic still needs it. Also because we have to recompile the entire project anyway, I've added in the--force
flag because that makes our later logic to fetch the build info file faster.FOUNDRY_BUILD_INFO: 'false'
. This prevents the users entire project from being rebuilt whenever we call into the script if the user hasbuild_info=true
in theirfoundry.toml
file.Note
Obviously, this is not the ideal solution. This PR aims to ensure the plugin continues to be usable in projects where compilation takes a long time, such as Sablier. We should further discuss the ideal solution which may involve implementing logic to use the cache when compiling with
build_info=true
in Foundry if that is reasonable to do.