foundry-rs / compilers

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

refactor: sparse output #135

Closed klkvr closed 4 weeks ago

klkvr commented 4 weeks ago

better approach for https://github.com/foundry-rs/foundry/pull/8061

We already keep all compilation settings on Project (paths, compier settings, compiler itself), so this PR moves sparse_output to Project as well to allow us to just configure it in Config::project instead of adding it to compiler on every invocation in multiple places.

Also this PR gets rid of separate SparseOutputFileFilter<D> trait and makes sparse_output filter just a FileFilter again. Instead, we now have ParsedSource::compilation_dependencies which determines which of the source imports must be compiled along with it.

Simplified some sparse output related logic along with changes.

Due to Box<dyn FileFilter> on Project this PR adds dyn-clone to keep Clone impl and derivative to avoid manually implementing Debug