Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

chore(solc): add more cache traces #2248

Merged
merged 2 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ethers-solc/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,10 @@ impl<'a, T: ArtifactOutput> ArtifactsCache<'a, T> {
write_to_disk: bool,
) -> Result<Artifacts<T::Artifact>> {
match self {
ArtifactsCache::Ephemeral(_, _) => Ok(Default::default()),
ArtifactsCache::Ephemeral(_, _) => {
tracing::trace!("no cache configured, ephemeral");
Ok(Default::default())
}
ArtifactsCache::Cached(cache) => {
let ArtifactsCacheInner {
mut cache,
Expand Down
7 changes: 4 additions & 3 deletions ethers-solc/src/compile/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,13 +358,14 @@ impl<'a, T: ArtifactOutput> ArtifactsState<'a, T> {
///
/// this concludes the [`Project::compile()`] statemachine
fn write_cache(self) -> Result<ProjectCompileOutput<T>> {
trace!("write cache");
let ArtifactsState { output, cache, compiled_artifacts } = self;
let project = cache.project();
let ignored_error_codes = project.ignored_error_codes.clone();
let compiler_severity_filter = project.compiler_severity_filter.clone();
let skip_write_to_disk = project.no_artifacts ||
output.has_error(&ignored_error_codes, &compiler_severity_filter);
let has_error = output.has_error(&ignored_error_codes, &compiler_severity_filter);
let skip_write_to_disk = project.no_artifacts || has_error;
trace!(has_error, project.no_artifacts, skip_write_to_disk, cache_path=?project.cache_path(),"prepare writing cache file");

let cached_artifacts = cache.consume(&compiled_artifacts, !skip_write_to_disk)?;
Ok(ProjectCompileOutput {
compiler_output: output,
Expand Down