From 97cc58afcf0cfd4c485d87021e621c3c00a06670 Mon Sep 17 00:00:00 2001 From: daimond113 <72147841+daimond113@users.noreply.github.com> Date: Tue, 26 Nov 2024 12:59:43 +0100 Subject: [PATCH] fix: link dependencies in x command --- src/cli/commands/execute.rs | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/cli/commands/execute.rs b/src/cli/commands/execute.rs index 4e7cd8e..6e88919 100644 --- a/src/cli/commands/execute.rs +++ b/src/cli/commands/execute.rs @@ -5,7 +5,7 @@ use fs_err::tokio as fs; use indicatif::MultiProgress; use pesde::{ linking::generator::generate_bin_linking_module, - manifest::target::TargetKind, + manifest::{target::TargetKind, DependencyType}, names::PackageName, source::{ pesde::{specifier::PesdeDependencySpecifier, PesdePackageSource}, @@ -14,7 +14,9 @@ use pesde::{ Project, }; use semver::VersionReq; -use std::{collections::HashSet, env::current_dir, ffi::OsString, io::Write, process::Command}; +use std::{ + collections::HashSet, env::current_dir, ffi::OsString, io::Write, process::Command, sync::Arc, +}; #[derive(Debug, Args)] pub struct ExecuteCommand { @@ -115,11 +117,10 @@ impl ExecuteCommand { .await .context("failed to build dependency graph")?; - let rx = project + let (rx, downloaded_graph) = project .download_graph(&graph, &mut refreshed_sources, &reqwest, true, true) .await - .context("failed to download dependencies")? - .0; + .context("failed to download dependencies")?; progress_bar( graph.values().map(|versions| versions.len() as u64).sum(), @@ -131,6 +132,28 @@ impl ExecuteCommand { ) .await?; + let downloaded_graph = Arc::into_inner(downloaded_graph) + .unwrap() + .into_inner() + .unwrap(); + + project + .link_dependencies( + &downloaded_graph + .into_iter() + .map(|(n, v)| { + ( + n, + v.into_iter() + .filter(|(_, n)| n.node.resolved_ty != DependencyType::Dev) + .collect(), + ) + }) + .collect(), + ) + .await + .context("failed to link dependencies")?; + let mut caller = tempfile::NamedTempFile::new_in(tempdir.path()).context("failed to create tempfile")?; caller