Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/forge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ opener = "0.8"

# soldeer
soldeer-commands.workspace = true
soldeer-core.workspace = true
quick-junit = "0.5.1"

[dev-dependencies]
Expand Down
38 changes: 38 additions & 0 deletions crates/forge/src/cmd/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ impl BuildArgs {
config = self.load_config()?;
}

self.check_soldeer_lock_consistency(&config).await;

let project = config.project()?;

// Collect sources to compile if build subdirectories specified.
Expand Down Expand Up @@ -207,6 +209,42 @@ impl BuildArgs {
Ok([config.src, config.test, config.script, foundry_toml])
})
}

/// Check soldeer.lock file consistency using soldeer_core APIs
async fn check_soldeer_lock_consistency(&self, config: &Config) {
let soldeer_lock_path = config.root.join("soldeer.lock");
if !soldeer_lock_path.exists() {
return;
}

let lockfile = match soldeer_core::lock::read_lockfile(&soldeer_lock_path) {
Ok(lock) => lock,
Err(_) => return,
};

let deps_dir = config.root.join("dependencies");
for entry in &lockfile.entries {
let dep_name = entry.name();

// Use soldeer_core's integrity check
match soldeer_core::install::check_dependency_integrity(entry, &deps_dir).await {
Ok(status) => {
use soldeer_core::install::DependencyStatus;
// Check if status indicates a problem
if matches!(
status,
DependencyStatus::Missing | DependencyStatus::FailedIntegrity
) {
sh_warn!("Dependency '{}' integrity check failed: {:?}", dep_name, status)
.ok();
}
}
Err(e) => {
sh_warn!("Dependency '{}' integrity check error: {}", dep_name, e).ok();
}
}
}
}
}

// Make this args a `figment::Provider` so that it can be merged into the `Config`
Expand Down
Loading