Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: always compile sources when running scripts #7738

Merged
merged 1 commit into from
Apr 20, 2024
Merged
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
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
Loading