fix(solc): compute content hashes first (#1142)
* chore: add tracing for missing content hash * fix: compute content hashes first
This commit is contained in:
parent
286f842a2a
commit
19a2ecd58d
|
@ -630,8 +630,6 @@ impl<'a, T: ArtifactOutput> ArtifactsCacheInner<'a, T> {
|
|||
/// so that their [OutputSelection] can be optimized in the [CompilerOutput] and their (empty)
|
||||
/// artifacts ignored.
|
||||
fn filter(&mut self, sources: Sources, version: &Version) -> FilteredSources {
|
||||
self.fill_hashes(&sources);
|
||||
|
||||
// all files that are not dirty themselves, but are pulled from a dirty file
|
||||
let mut imports_of_dirty = HashSet::new();
|
||||
|
||||
|
@ -728,6 +726,8 @@ impl<'a, T: ArtifactOutput> ArtifactsCacheInner<'a, T> {
|
|||
return false
|
||||
}
|
||||
tracing::trace!("Missing cache entry for {}", file.display());
|
||||
} else {
|
||||
tracing::trace!("Missing content hash for {}", file.display());
|
||||
}
|
||||
true
|
||||
}
|
||||
|
@ -833,6 +833,14 @@ impl<'a, T: ArtifactOutput> ArtifactsCache<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Adds the file's hashes to the set if not set yet
|
||||
pub fn fill_content_hashes(&mut self, sources: &Sources) {
|
||||
match self {
|
||||
ArtifactsCache::Ephemeral(_, _) => {}
|
||||
ArtifactsCache::Cached(cache) => cache.fill_hashes(sources),
|
||||
}
|
||||
}
|
||||
|
||||
/// Filters out those sources that don't need to be compiled
|
||||
pub fn filter(&mut self, sources: Sources, version: &Version) -> FilteredSources {
|
||||
match self {
|
||||
|
|
|
@ -331,6 +331,11 @@ impl CompilerSources {
|
|||
sources: VersionedSources,
|
||||
cache: &mut ArtifactsCache<T>,
|
||||
) -> VersionedFilteredSources {
|
||||
// fill all content hashes first so they're available for all source sets
|
||||
sources.iter().for_each(|(_, (_, sources))| {
|
||||
cache.fill_content_hashes(sources);
|
||||
});
|
||||
|
||||
sources
|
||||
.into_iter()
|
||||
.map(|(solc, (version, sources))| {
|
||||
|
|
Loading…
Reference in New Issue