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

Commit

Permalink
chore(solc): add more cache traces (#2248)
Browse files Browse the repository at this point in the history
* chore(solc): add more cache traces

* simplify bools
  • Loading branch information
mattsse authored Mar 13, 2023
1 parent 862d923 commit d073930
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
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

0 comments on commit d073930

Please sign in to comment.