diff --git a/Cargo.lock b/Cargo.lock index 7130c61390c3..b20bdaf846b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3687,8 +3687,7 @@ dependencies = [ [[package]] name = "foundry-compilers" version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eaa24a47bb84e1db38c84f03e8c90ca81050bd20beac8bdc99aae8afd0b8784" +source = "git+https://github.com/foundry-rs/compilers?rev=a379db3#a379db3eba7739500c7062381503c82a6b556eee" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -3725,8 +3724,7 @@ dependencies = [ [[package]] name = "foundry-compilers-artifacts" version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3588ee6a986f89040d1158fb90459731580b404fb72b8c6c832c0ddbc95fed58" +source = "git+https://github.com/foundry-rs/compilers?rev=a379db3#a379db3eba7739500c7062381503c82a6b556eee" dependencies = [ "foundry-compilers-artifacts-solc", "foundry-compilers-artifacts-vyper", @@ -3735,8 +3733,7 @@ dependencies = [ [[package]] name = "foundry-compilers-artifacts-solc" version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a149c5e8c326c7bae8f73cacb28c637f4bc2e535f950eec10348494990e9636f" +source = "git+https://github.com/foundry-rs/compilers?rev=a379db3#a379db3eba7739500c7062381503c82a6b556eee" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -3759,8 +3756,7 @@ dependencies = [ [[package]] name = "foundry-compilers-artifacts-vyper" version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8645c9e7c070c81bf8c90f456416953234334f097b67445c773af98df74e27b0" +source = "git+https://github.com/foundry-rs/compilers?rev=a379db3#a379db3eba7739500c7062381503c82a6b556eee" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -3774,8 +3770,7 @@ dependencies = [ [[package]] name = "foundry-compilers-core" version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66492aeb708f3d142c078457dba5f52b04ca5031012d48903a0bcb37d205d595" +source = "git+https://github.com/foundry-rs/compilers?rev=a379db3#a379db3eba7739500c7062381503c82a6b556eee" dependencies = [ "alloy-primitives", "cfg-if", diff --git a/Cargo.toml b/Cargo.toml index 9aa6ab471e6a..3996e9c6cf73 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -287,3 +287,5 @@ alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "511ae9 alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "511ae98" } revm = { git = "https://github.com/bluealloy/revm", rev = "caadc71" } revm-primitives = { git = "https://github.com/bluealloy/revm", rev = "caadc71" } + +foundry-compilers = { git = "https://github.com/foundry-rs/compilers", rev = "a379db3" } \ No newline at end of file diff --git a/crates/common/src/compile.rs b/crates/common/src/compile.rs index 0c39dd873498..ba9fc63ec02e 100644 --- a/crates/common/src/compile.rs +++ b/crates/common/src/compile.rs @@ -10,6 +10,8 @@ use foundry_compilers::{ solc::{Solc, SolcCompiler}, Compiler, }, + preprocessor::{TestOptimizerPreprocessor}, + project::Preprocessor, report::{BasicStdoutReporter, NoReporter, Report}, solc::SolcSettings, Artifact, Project, ProjectBuilder, ProjectCompileOutput, ProjectPathsConfig, SolcConfig, @@ -122,7 +124,10 @@ impl ProjectCompiler { } /// Compiles the project. - pub fn compile(mut self, project: &Project) -> Result> { + pub fn compile(mut self, project: &Project) -> Result> + where + TestOptimizerPreprocessor: Preprocessor, + { // TODO: Avoid process::exit if !project.paths.has_input_files() && self.files.is_empty() { println!("Nothing to compile"); @@ -140,6 +145,7 @@ impl ProjectCompiler { }; foundry_compilers::project::ProjectCompiler::with_sources(project, sources)? + .with_preprocessor(TestOptimizerPreprocessor) .compile() .map_err(Into::into) }) @@ -361,7 +367,10 @@ pub fn compile_target( target_path: &Path, project: &Project, quiet: bool, -) -> Result> { +) -> Result> +where + TestOptimizerPreprocessor: Preprocessor, +{ ProjectCompiler::new().quiet(quiet).files([target_path.into()]).compile(project) }