mirror of
https://github.com/pesde-pkg/pesde.git
synced 2025-05-04 10:33:47 +01:00
refactor: remove unused imports
This commit is contained in:
parent
91229d92be
commit
a127e2fcbb
4 changed files with 18 additions and 16 deletions
|
@ -11,18 +11,15 @@ use console::style;
|
||||||
use fs_err::tokio as fs;
|
use fs_err::tokio as fs;
|
||||||
use pesde::{
|
use pesde::{
|
||||||
download_and_link::{DownloadAndLinkHooks, DownloadAndLinkOptions, InstallDependenciesMode},
|
download_and_link::{DownloadAndLinkHooks, DownloadAndLinkOptions, InstallDependenciesMode},
|
||||||
engine::EngineKind,
|
|
||||||
graph::{DependencyGraph, DependencyGraphWithTarget},
|
graph::{DependencyGraph, DependencyGraphWithTarget},
|
||||||
lockfile::Lockfile,
|
lockfile::Lockfile,
|
||||||
manifest::{DependencyType, Manifest},
|
manifest::DependencyType,
|
||||||
names::PackageNames,
|
names::PackageNames,
|
||||||
source::{
|
source::{
|
||||||
pesde::PesdePackageSource,
|
|
||||||
refs::PackageRefs,
|
|
||||||
traits::{PackageRef as _, RefreshOptions},
|
traits::{PackageRef as _, RefreshOptions},
|
||||||
PackageSources,
|
PackageSources,
|
||||||
},
|
},
|
||||||
version_matches, Project, RefreshedSources, MANIFEST_FILE_NAME,
|
Project, RefreshedSources,
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
collections::{BTreeMap, BTreeSet, HashSet},
|
collections::{BTreeMap, BTreeSet, HashSet},
|
||||||
|
@ -284,6 +281,8 @@ pub async fn install(
|
||||||
|
|
||||||
#[cfg(feature = "version-management")]
|
#[cfg(feature = "version-management")]
|
||||||
{
|
{
|
||||||
|
use pesde::{source::{refs::PackageRefs, pesde::PesdePackageSource}, MANIFEST_FILE_NAME, version_matches, manifest::Manifest, engine::EngineKind};
|
||||||
|
|
||||||
let manifest_target_kind = manifest.target.kind();
|
let manifest_target_kind = manifest.target.kind();
|
||||||
let mut tasks = downloaded_graph.iter()
|
let mut tasks = downloaded_graph.iter()
|
||||||
.map(|(id, node)| {
|
.map(|(id, node)| {
|
||||||
|
|
|
@ -23,7 +23,6 @@ use pesde::{
|
||||||
Project, DEFAULT_INDEX_NAME,
|
Project, DEFAULT_INDEX_NAME,
|
||||||
};
|
};
|
||||||
use relative_path::RelativePathBuf;
|
use relative_path::RelativePathBuf;
|
||||||
use reporters::run_with_reporter;
|
|
||||||
use semver::Version;
|
use semver::Version;
|
||||||
use std::{
|
use std::{
|
||||||
collections::{BTreeMap, HashMap, HashSet},
|
collections::{BTreeMap, HashMap, HashSet},
|
||||||
|
@ -59,6 +58,7 @@ pub fn bin_dir() -> anyhow::Result<PathBuf> {
|
||||||
Ok(base_dir()?.join("bin"))
|
Ok(base_dir()?.join("bin"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "version-management")]
|
||||||
pub fn engines_dir() -> anyhow::Result<PathBuf> {
|
pub fn engines_dir() -> anyhow::Result<PathBuf> {
|
||||||
Ok(base_dir()?.join("engines"))
|
Ok(base_dir()?.join("engines"))
|
||||||
}
|
}
|
||||||
|
@ -375,7 +375,7 @@ pub async fn get_project_engines(
|
||||||
) -> anyhow::Result<HashMap<EngineKind, Version>> {
|
) -> anyhow::Result<HashMap<EngineKind, Version>> {
|
||||||
use tokio::task::JoinSet;
|
use tokio::task::JoinSet;
|
||||||
|
|
||||||
run_with_reporter(|_, root_progress, reporter| async {
|
crate::cli::reporters::run_with_reporter(|_, root_progress, reporter| async {
|
||||||
let root_progress = root_progress;
|
let root_progress = root_progress;
|
||||||
let reporter = reporter;
|
let reporter = reporter;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ pub mod incremental;
|
||||||
async fn create_and_canonicalize<P: AsRef<Path>>(path: P) -> std::io::Result<PathBuf> {
|
async fn create_and_canonicalize<P: AsRef<Path>>(path: P) -> std::io::Result<PathBuf> {
|
||||||
let p = path.as_ref();
|
let p = path.as_ref();
|
||||||
fs::create_dir_all(p).await?;
|
fs::create_dir_all(p).await?;
|
||||||
p.canonicalize()
|
fs::canonicalize(p).await
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn write_cas(destination: PathBuf, cas_dir: &Path, contents: &str) -> std::io::Result<()> {
|
async fn write_cas(destination: PathBuf, cas_dir: &Path, contents: &str) -> std::io::Result<()> {
|
||||||
|
|
19
src/main.rs
19
src/main.rs
|
@ -7,10 +7,9 @@ use cli::{compatible_runtime, data_dir, get_project_engines};
|
||||||
use fs_err::tokio as fs;
|
use fs_err::tokio as fs;
|
||||||
use indicatif::MultiProgress;
|
use indicatif::MultiProgress;
|
||||||
use pesde::{
|
use pesde::{
|
||||||
engine::EngineKind, find_roots, manifest::target::TargetKind, version_matches, AuthConfig,
|
engine::EngineKind, find_roots, manifest::target::TargetKind, AuthConfig, Project,
|
||||||
Project, MANIFEST_FILE_NAME,
|
MANIFEST_FILE_NAME,
|
||||||
};
|
};
|
||||||
use semver::VersionReq;
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
io,
|
io,
|
||||||
|
@ -332,17 +331,21 @@ async fn run() -> anyhow::Result<()> {
|
||||||
if engine == EngineKind::Pesde {
|
if engine == EngineKind::Pesde {
|
||||||
match &req {
|
match &req {
|
||||||
// we're already running a compatible version
|
// we're already running a compatible version
|
||||||
Some(req) if version_matches(req, ¤t_version()) => break 'engines,
|
Some(req) if pesde::version_matches(req, ¤t_version()) => break 'engines,
|
||||||
// the user has not requested a specific version, so we'll just use the current one
|
// the user has not requested a specific version, so we'll just use the current one
|
||||||
None => break 'engines,
|
None => break 'engines,
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let exe_path =
|
let exe_path = get_or_download_engine(
|
||||||
get_or_download_engine(&reqwest, engine, req.unwrap_or(VersionReq::STAR), ().into())
|
&reqwest,
|
||||||
.await?
|
engine,
|
||||||
.0;
|
req.unwrap_or(semver::VersionReq::STAR),
|
||||||
|
().into(),
|
||||||
|
)
|
||||||
|
.await?
|
||||||
|
.0;
|
||||||
if exe_path == current_exe {
|
if exe_path == current_exe {
|
||||||
anyhow::bail!("engine linker executed by itself")
|
anyhow::bail!("engine linker executed by itself")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue