Skip to content

Commit

Permalink
Renamed the recursiveness error
Browse files Browse the repository at this point in the history
  • Loading branch information
mario-eth committed Aug 9, 2024
1 parent 2f49d1e commit 953324a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 45 deletions.
45 changes: 1 addition & 44 deletions src/dependency_downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,50 +278,7 @@ fn install_subdependencies(dependency: &Dependency) -> Result<()> {

let dep_dir = DEPENDENCY_DIR.join(dep_name);
if !dep_dir.exists() {
return Err(DownloadError::RecursivenessError(
"Dependency directory does not exists".to_string(),
));
}

let mut git = Command::new("git");

let result = git
.args(["submodule", "update", "--init", "--recursive"])
.env("GIT_TERMINAL_PROMPT", "0")
.current_dir(&dep_dir)
.stdout(Stdio::piped())
.stderr(Stdio::piped());

let status = result.status().expect("Subdependency via GIT failed");

if !status.success() {
println!("{}", "Dependency has no submodule dependency.".yellow());
}

let mut soldeer = Command::new("forge");

let result = soldeer
.args(["soldeer", "install"])
.current_dir(&dep_dir)
.stdout(Stdio::piped())
.stderr(Stdio::piped());

let status = result.status().expect("Subdependency via Soldeer failed");

if !status.success() {
println!("{}", "Dependency has no Soldeer dependency.".yellow());
}

Ok(())
}

fn install_subdependencies(dependency: &Dependency) -> Result<()> {
let dep_name =
sanitize_dependency_name(&format!("{}-{}", dependency.name(), dependency.version()));

let dep_dir = DEPENDENCY_DIR.join(dep_name);
if !dep_dir.exists() {
return Err(DownloadError::RecursivenessError(
return Err(DownloadError::SubdependencyError(
"Dependency directory does not exists".to_string(),
));
}
Expand Down
2 changes: 1 addition & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pub enum DownloadError {
AsyncError(#[from] tokio::task::JoinError),

#[error("Could download the dependencies of this dependency {0}")]
RecursivenessError(String),
SubdependencyError(String),
}

#[derive(Error, Debug)]
Expand Down

0 comments on commit 953324a

Please sign in to comment.