WIP compilation cache

This commit is contained in:
Omar Abdulla
2025-08-16 14:55:02 +03:00
parent a59e287fa1
commit 0038634695
5 changed files with 451 additions and 6 deletions
+2
View File
@@ -23,6 +23,7 @@ revive-dt-report = { workspace = true }
alloy = { workspace = true }
anyhow = { workspace = true }
cacache = { workspace = true }
clap = { workspace = true }
futures = { workspace = true }
indexmap = { workspace = true }
@@ -30,5 +31,6 @@ tokio = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
semver = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
temp-dir = { workspace = true }
+30
View File
@@ -0,0 +1,30 @@
//! A wrapper around the compiler which allows for caching of compilation artifacts so that they can
//! be reused between runs.
use std::path::{Path, PathBuf};
use anyhow::{Error, Result};
use revive_dt_format::mode::SolcMode;
use serde::{Deserialize, Serialize};
struct ArtifactsCache {
path: PathBuf,
}
impl ArtifactsCache {
pub fn new(path: impl AsRef<Path>) -> Self {
Self {
path: path.as_ref().to_path_buf(),
}
}
pub fn with_invalidated_cache(self) -> Result<Self> {
cacache::clear_sync(self.path.as_path()).map_err(Into::<Error>::into)?;
Ok(self)
}
}
struct CacheKey {
metadata_file_path: PathBuf,
solc_mode: SolcMode,
}
+1
View File
@@ -9,6 +9,7 @@ use revive_dt_format::traits::ResolverApi;
use revive_dt_node::{Node, geth, kitchensink::KitchensinkNode};
use revive_dt_node_interaction::EthereumNode;
mod cached_compiler;
pub mod driver;
/// One platform can be tested differentially against another.