mirror of
https://github.com/pesde-pkg/pesde.git
synced 2025-01-09 17:29:10 +00:00
fix: do not error on missing deps until full linking
Some checks are pending
Test & Lint / lint (push) Waiting to run
Some checks are pending
Test & Lint / lint (push) Waiting to run
This commit is contained in:
parent
a6c1108d5b
commit
0f74e2efa3
3 changed files with 19 additions and 8 deletions
|
@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Fixed
|
||||
- Change dependency types for removed peer dependencies by @daimond113
|
||||
- Resolve version to correct tag for `pesde_version` field by @daimond113
|
||||
- Do not error on missing dependencies until full linking by @daimond113
|
||||
|
||||
### Changed
|
||||
- Switch from `log` to `tracing` for logging by @daimond113
|
||||
|
|
|
@ -11,7 +11,7 @@ use std::{
|
|||
sync::{Arc, Mutex as StdMutex},
|
||||
};
|
||||
use tokio::sync::Mutex;
|
||||
use tracing::instrument;
|
||||
use tracing::{instrument, Instrument};
|
||||
|
||||
/// Filters a graph to only include production dependencies, if `prod` is `true`
|
||||
pub fn filter_graph(graph: &DownloadedGraph, prod: bool) -> DownloadedGraph {
|
||||
|
@ -85,6 +85,7 @@ impl Project {
|
|||
// step 1. download pesde dependencies
|
||||
let (mut pesde_rx, pesde_graph) = this
|
||||
.download_graph(&graph, &mut refreshed_sources, &reqwest, prod, write, false)
|
||||
.instrument(tracing::debug_span!("download (pesde)"))
|
||||
.await?;
|
||||
|
||||
while let Some(result) = pesde_rx.recv().await {
|
||||
|
@ -96,6 +97,7 @@ impl Project {
|
|||
// step 2. link pesde dependencies. do so without types
|
||||
if write {
|
||||
this.link_dependencies(&filter_graph(&pesde_graph, prod), false)
|
||||
.instrument(tracing::debug_span!("link (pesde)"))
|
||||
.await?;
|
||||
}
|
||||
|
||||
|
@ -110,6 +112,7 @@ impl Project {
|
|||
// step 3. download wally dependencies
|
||||
let (mut wally_rx, wally_graph) = this
|
||||
.download_graph(&graph, &mut refreshed_sources, &reqwest, prod, write, true)
|
||||
.instrument(tracing::debug_span!("download (wally)"))
|
||||
.await?;
|
||||
|
||||
while let Some(result) = wally_rx.recv().await {
|
||||
|
@ -139,6 +142,7 @@ impl Project {
|
|||
// step 4. link ALL dependencies. do so with types
|
||||
if write {
|
||||
this.link_dependencies(&filter_graph(&graph, prod), true)
|
||||
.instrument(tracing::debug_span!("link (all)"))
|
||||
.await?;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ impl Project {
|
|||
|
||||
// step 1. link all non-wally packages (and their dependencies) temporarily without types
|
||||
// we do this separately to allow the required tools for the scripts to be installed
|
||||
self.link(graph, &manifest, &Arc::new(Default::default()))
|
||||
self.link(graph, &manifest, &Arc::new(Default::default()), false)
|
||||
.await?;
|
||||
|
||||
if !with_types {
|
||||
|
@ -156,7 +156,8 @@ impl Project {
|
|||
.collect::<HashMap<_, _>>();
|
||||
|
||||
// step 3. link all packages (and their dependencies), this time with types
|
||||
self.link(graph, &manifest, &Arc::new(package_types)).await
|
||||
self.link(graph, &manifest, &Arc::new(package_types), true)
|
||||
.await
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
|
@ -245,6 +246,7 @@ impl Project {
|
|||
graph: &DownloadedGraph,
|
||||
manifest: &Arc<Manifest>,
|
||||
package_types: &Arc<HashMap<&PackageNames, HashMap<&VersionId, Vec<String>>>>,
|
||||
is_complete: bool,
|
||||
) -> Result<(), errors::LinkingError> {
|
||||
try_join_all(graph.iter().flat_map(|(name, versions)| {
|
||||
versions.iter().map(|(version_id, node)| {
|
||||
|
@ -299,10 +301,14 @@ impl Project {
|
|||
.get(dependency_name)
|
||||
.and_then(|v| v.get(dependency_version_id))
|
||||
else {
|
||||
return Err(errors::LinkingError::DependencyNotFound(
|
||||
dependency_name.to_string(),
|
||||
dependency_version_id.to_string(),
|
||||
));
|
||||
if is_complete {
|
||||
return Err(errors::LinkingError::DependencyNotFound(
|
||||
format!("{dependency_name}@{dependency_version_id}"),
|
||||
format!("{name}@{version_id}"),
|
||||
));
|
||||
}
|
||||
|
||||
continue;
|
||||
};
|
||||
|
||||
let base_folder = create_and_canonicalize(
|
||||
|
@ -371,7 +377,7 @@ pub mod errors {
|
|||
Io(#[from] std::io::Error),
|
||||
|
||||
/// A dependency was not found
|
||||
#[error("dependency not found: {0}@{1}")]
|
||||
#[error("dependency `{0}` of `{1}` not found")]
|
||||
DependencyNotFound(String, String),
|
||||
|
||||
/// The library file was not found
|
||||
|
|
Loading…
Reference in a new issue