Skip to content

Commit

Permalink
fix: always compile sources when running scripts (#7738)
Browse files Browse the repository at this point in the history
  • Loading branch information
klkvr authored Apr 20, 2024
1 parent dba274d commit 167295e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions crates/script/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ use alloy_provider::Provider;
use eyre::{OptionExt, Result};
use foundry_cheatcodes::ScriptWallets;
use foundry_common::{
compile::{self, ContractSources},
compile::{ContractSources, ProjectCompiler},
provider::alloy::try_get_http_provider,
ContractData, ContractsByArtifact,
};
use foundry_compilers::{
artifacts::{BytecodeObject, Libraries},
info::ContractInfo,
utils::source_files_iter,
ArtifactId, ProjectCompileOutput,
};
use foundry_linking::{LinkOutput, Linker};
Expand Down Expand Up @@ -149,7 +150,13 @@ impl PreprocessedState {
}
};

let output = compile::compile_target(&target_path, &project, args.opts.silent)?;
let sources_to_compile =
source_files_iter(project.paths.sources.as_path()).chain([target_path.to_path_buf()]);

let output = ProjectCompiler::new()
.quiet_if(args.opts.silent)
.files(sources_to_compile)
.compile(&project)?;

let mut target_id: Option<ArtifactId> = None;

Expand Down

0 comments on commit 167295e

Please sign in to comment.