Currently, during sparse compilation (and probably in some other cases) we might end up in a situation when cache contains empty entries which can actually produce artifacts when compied.
For example, if A.sol imports B.sol and sparse filter tells us to only compile A.sol, then B.sol will appear in cache (because we have to track its source hash to invalidate A.sol's cache), however, we will erase its output selection when invoking solc, so it will not have any artifacts.
Because of that, artifact for B.sol will be missing until the cache is cleared.
The issue is basically that we might have two situations:
Entry does not contain artifacts because it does not produce them when compiled
Entry does not contain artifacts because we've never tried to compile it
This PR adds seenByCompiler flag which is set to false by default for all newly created entries and switched when entries are compiled as dirty files (without pruned output selection).
Currently, during sparse compilation (and probably in some other cases) we might end up in a situation when cache contains empty entries which can actually produce artifacts when compied.
For example, if A.sol imports B.sol and sparse filter tells us to only compile A.sol, then B.sol will appear in cache (because we have to track its source hash to invalidate A.sol's cache), however, we will erase its output selection when invoking solc, so it will not have any artifacts.
Thus, if compiler is invoked later without sparse filter, it will simply skip compiling B.sol because it will assume that it just does not contain any contract definitions: https://github.com/foundry-rs/compilers/blob/4cf78434b21481c78a8236c95ac82eb945a01758/src/cache.rs#L658-L663
Because of that, artifact for B.sol will be missing until the cache is cleared.
The issue is basically that we might have two situations:
This PR adds
seenByCompiler
flag which is set to false by default for all newly created entries and switched when entries are compiled as dirty files (without pruned output selection).