fix: link dependencies in x command

This commit is contained in:
daimond113 2024-11-26 12:59:43 +01:00
parent b5b3257cac
commit 97cc58afcf
No known key found for this signature in database
GPG key ID: 3A8ECE51328B513C

View file

@ -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