mirror of
https://github.com/pesde-pkg/pesde.git
synced 2024-12-12 11:00:36 +00:00
fix: install dependencies of packages in x command
This commit is contained in:
parent
15d6655889
commit
b5b3257cac
7 changed files with 59 additions and 18 deletions
|
@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Make `includes` use glob patterns by @daimond113
|
- Make `includes` use glob patterns by @daimond113
|
||||||
- Use symlinks for workspace dependencies to not require reinstalling by @daimond113
|
- Use symlinks for workspace dependencies to not require reinstalling by @daimond113
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Install dependencies of packages in `x` command
|
||||||
|
|
||||||
## [0.5.0-rc.12] - 2024-11-22
|
## [0.5.0-rc.12] - 2024-11-22
|
||||||
### Added
|
### Added
|
||||||
- Support fallback Wally registries by @daimond113
|
- Support fallback Wally registries by @daimond113
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use crate::cli::{config::read_config, VersionedPackageName};
|
use crate::cli::{config::read_config, progress_bar, VersionedPackageName};
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use clap::Args;
|
use clap::Args;
|
||||||
use fs_err::tokio as fs;
|
use fs_err::tokio as fs;
|
||||||
|
use indicatif::MultiProgress;
|
||||||
use pesde::{
|
use pesde::{
|
||||||
linking::generator::generate_bin_linking_module,
|
linking::generator::generate_bin_linking_module,
|
||||||
manifest::target::TargetKind,
|
manifest::target::TargetKind,
|
||||||
|
@ -31,7 +32,12 @@ pub struct ExecuteCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ExecuteCommand {
|
impl ExecuteCommand {
|
||||||
pub async fn run(self, project: Project, reqwest: reqwest::Client) -> anyhow::Result<()> {
|
pub async fn run(
|
||||||
|
self,
|
||||||
|
project: Project,
|
||||||
|
multi: MultiProgress,
|
||||||
|
reqwest: reqwest::Client,
|
||||||
|
) -> anyhow::Result<()> {
|
||||||
let index = match self.index {
|
let index = match self.index {
|
||||||
Some(index) => Some(index),
|
Some(index) => Some(index),
|
||||||
None => read_config().await.ok().map(|c| c.default_index),
|
None => read_config().await.ok().map(|c| c.default_index),
|
||||||
|
@ -77,24 +83,54 @@ impl ExecuteCommand {
|
||||||
|
|
||||||
log::info!("found package {}@{version}", pkg_ref.name);
|
log::info!("found package {}@{version}", pkg_ref.name);
|
||||||
|
|
||||||
|
let tmp_dir = project.cas_dir().join(".tmp");
|
||||||
|
fs::create_dir_all(&tmp_dir)
|
||||||
|
.await
|
||||||
|
.context("failed to create temporary directory")?;
|
||||||
|
let tempdir =
|
||||||
|
tempfile::tempdir_in(tmp_dir).context("failed to create temporary directory")?;
|
||||||
|
|
||||||
|
let project = Project::new(
|
||||||
|
tempdir.path(),
|
||||||
|
None::<std::path::PathBuf>,
|
||||||
|
project.data_dir(),
|
||||||
|
project.cas_dir(),
|
||||||
|
project.auth_config().clone(),
|
||||||
|
);
|
||||||
|
|
||||||
let (fs, target) = source
|
let (fs, target) = source
|
||||||
.download(&pkg_ref, &project, &reqwest)
|
.download(&pkg_ref, &project, &reqwest)
|
||||||
.await
|
.await
|
||||||
.context("failed to download package")?;
|
.context("failed to download package")?;
|
||||||
let bin_path = target.bin_path().context("package has no binary export")?;
|
let bin_path = target.bin_path().context("package has no binary export")?;
|
||||||
|
|
||||||
let tmp_dir = project.cas_dir().join(".tmp");
|
|
||||||
fs::create_dir_all(&tmp_dir)
|
|
||||||
.await
|
|
||||||
.context("failed to create temporary directory")?;
|
|
||||||
|
|
||||||
let tempdir =
|
|
||||||
tempfile::tempdir_in(tmp_dir).context("failed to create temporary directory")?;
|
|
||||||
|
|
||||||
fs.write_to(tempdir.path(), project.cas_dir(), true)
|
fs.write_to(tempdir.path(), project.cas_dir(), true)
|
||||||
.await
|
.await
|
||||||
.context("failed to write package contents")?;
|
.context("failed to write package contents")?;
|
||||||
|
|
||||||
|
let mut refreshed_sources = HashSet::new();
|
||||||
|
|
||||||
|
let graph = project
|
||||||
|
.dependency_graph(None, &mut refreshed_sources, true)
|
||||||
|
.await
|
||||||
|
.context("failed to build dependency graph")?;
|
||||||
|
|
||||||
|
let rx = project
|
||||||
|
.download_graph(&graph, &mut refreshed_sources, &reqwest, true, true)
|
||||||
|
.await
|
||||||
|
.context("failed to download dependencies")?
|
||||||
|
.0;
|
||||||
|
|
||||||
|
progress_bar(
|
||||||
|
graph.values().map(|versions| versions.len() as u64).sum(),
|
||||||
|
rx,
|
||||||
|
&multi,
|
||||||
|
"📥 ".to_string(),
|
||||||
|
"downloading dependencies".to_string(),
|
||||||
|
"downloaded dependencies".to_string(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
let mut caller =
|
let mut caller =
|
||||||
tempfile::NamedTempFile::new_in(tempdir.path()).context("failed to create tempfile")?;
|
tempfile::NamedTempFile::new_in(tempdir.path()).context("failed to create tempfile")?;
|
||||||
caller
|
caller
|
||||||
|
|
|
@ -195,7 +195,7 @@ impl InstallCommand {
|
||||||
println!("{} 📦 building dependency graph", job(2));
|
println!("{} 📦 building dependency graph", job(2));
|
||||||
|
|
||||||
let graph = project
|
let graph = project
|
||||||
.dependency_graph(old_graph.as_ref(), &mut refreshed_sources)
|
.dependency_graph(old_graph.as_ref(), &mut refreshed_sources, false)
|
||||||
.await
|
.await
|
||||||
.context("failed to build dependency graph")?;
|
.context("failed to build dependency graph")?;
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ impl Subcommand {
|
||||||
Subcommand::Add(add) => add.run(project).await,
|
Subcommand::Add(add) => add.run(project).await,
|
||||||
Subcommand::Update(update) => update.run(project, multi, reqwest).await,
|
Subcommand::Update(update) => update.run(project, multi, reqwest).await,
|
||||||
Subcommand::Outdated(outdated) => outdated.run(project).await,
|
Subcommand::Outdated(outdated) => outdated.run(project).await,
|
||||||
Subcommand::Execute(execute) => execute.run(project, reqwest).await,
|
Subcommand::Execute(execute) => execute.run(project, multi, reqwest).await,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,9 +230,10 @@ info: otherwise, the file was deemed unnecessary, if you don't understand why, p
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if roblox_target.as_mut().is_some_and(|build_files| {
|
if roblox_target
|
||||||
build_files.insert(first_part.to_string())
|
.as_mut()
|
||||||
}) {
|
.is_some_and(|build_files| build_files.insert(first_part.to_string()))
|
||||||
|
{
|
||||||
println!(
|
println!(
|
||||||
"{}: {name} was not in build files, adding {first_part}",
|
"{}: {name} was not in build files, adding {first_part}",
|
||||||
"warn".yellow().bold()
|
"warn".yellow().bold()
|
||||||
|
|
|
@ -31,7 +31,7 @@ impl UpdateCommand {
|
||||||
);
|
);
|
||||||
|
|
||||||
let graph = project
|
let graph = project
|
||||||
.dependency_graph(None, &mut refreshed_sources)
|
.dependency_graph(None, &mut refreshed_sources, false)
|
||||||
.await
|
.await
|
||||||
.context("failed to build dependency graph")?;
|
.context("failed to build dependency graph")?;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ impl Project {
|
||||||
&self,
|
&self,
|
||||||
previous_graph: Option<&DependencyGraph>,
|
previous_graph: Option<&DependencyGraph>,
|
||||||
refreshed_sources: &mut HashSet<PackageSources>,
|
refreshed_sources: &mut HashSet<PackageSources>,
|
||||||
|
manifest_transformed: bool,
|
||||||
) -> Result<DependencyGraph, Box<errors::DependencyGraphError>> {
|
) -> Result<DependencyGraph, Box<errors::DependencyGraphError>> {
|
||||||
let manifest = self
|
let manifest = self
|
||||||
.deser_manifest()
|
.deser_manifest()
|
||||||
|
@ -139,7 +140,7 @@ impl Project {
|
||||||
);
|
);
|
||||||
let source = match &specifier {
|
let source = match &specifier {
|
||||||
DependencySpecifiers::Pesde(specifier) => {
|
DependencySpecifiers::Pesde(specifier) => {
|
||||||
let index_url = if depth == 0 || overridden {
|
let index_url = if !manifest_transformed && (depth == 0 || overridden) {
|
||||||
let index_name = specifier.index.as_deref().unwrap_or(DEFAULT_INDEX_NAME);
|
let index_name = specifier.index.as_deref().unwrap_or(DEFAULT_INDEX_NAME);
|
||||||
|
|
||||||
manifest
|
manifest
|
||||||
|
@ -163,7 +164,7 @@ impl Project {
|
||||||
}
|
}
|
||||||
#[cfg(feature = "wally-compat")]
|
#[cfg(feature = "wally-compat")]
|
||||||
DependencySpecifiers::Wally(specifier) => {
|
DependencySpecifiers::Wally(specifier) => {
|
||||||
let index_url = if depth == 0 || overridden {
|
let index_url = if !manifest_transformed && (depth == 0 || overridden) {
|
||||||
let index_name = specifier.index.as_deref().unwrap_or(DEFAULT_INDEX_NAME);
|
let index_name = specifier.index.as_deref().unwrap_or(DEFAULT_INDEX_NAME);
|
||||||
|
|
||||||
manifest
|
manifest
|
||||||
|
|
Loading…
Reference in a new issue