foundry-rs / compilers

Utilities for working with native solc and compiling projects.
Apache License 2.0
58 stars 36 forks source link

refactor: caching logic #90

Closed klkvr closed 3 months ago

klkvr commented 3 months ago

Currently we are not keeping cache entries for files which were out of scope of compiler (might be dirty or not)

Because of that, when running forge compile, then running forge compile --skip ... which will filter some artifacts out, and then running forge compile again, some artifacts will be recompiled, because --skip run removed those entries from cache.

Solution is to keep those entries in cache (we already silently keep artifacts anyway).

klkvr commented 3 months ago

Patched https://github.com/foundry-rs/foundry/pull/7334 with this PR branch, will merge after it succeeds

klkvr commented 3 months ago

@mattsse @onbjerg mind taking one more look? updated impl after failed foundry ci

it should become a little bit more safer now, there were some edge cases with multiple versions when we could have dirty artifacts staying in cache