mirror of
https://github.com/pesde-pkg/pesde.git
synced 2025-04-10 22:00:55 +01:00
fix: compile without feature flags
Some checks are pending
Debug / Get build version (push) Waiting to run
Debug / Build for linux-x86_64 (push) Blocked by required conditions
Debug / Build for macos-aarch64 (push) Blocked by required conditions
Debug / Build for macos-x86_64 (push) Blocked by required conditions
Debug / Build for windows-x86_64 (push) Blocked by required conditions
Test & Lint / lint (push) Waiting to run
Some checks are pending
Debug / Get build version (push) Waiting to run
Debug / Build for linux-x86_64 (push) Blocked by required conditions
Debug / Build for macos-aarch64 (push) Blocked by required conditions
Debug / Build for macos-x86_64 (push) Blocked by required conditions
Debug / Build for windows-x86_64 (push) Blocked by required conditions
Test & Lint / lint (push) Waiting to run
This commit is contained in:
parent
5d62549817
commit
9bf2af6454
6 changed files with 65 additions and 56 deletions
|
@ -29,7 +29,6 @@ bin = [
|
|||
"tokio/rt",
|
||||
"tokio/rt-multi-thread",
|
||||
"tokio/macros",
|
||||
"dep:tempfile",
|
||||
]
|
||||
wally-compat = ["dep:async_zip", "dep:serde_json"]
|
||||
patches = ["dep:git2"]
|
||||
|
@ -65,6 +64,7 @@ full_moon = { version = "1.1.2", features = ["luau"] }
|
|||
url = { version = "2.5.4", features = ["serde"] }
|
||||
chrono = { version = "0.4.39", features = ["serde"] }
|
||||
sha2 = "0.10.8"
|
||||
tempfile = "3.14.0"
|
||||
wax = { version = "0.6.0", default-features = false }
|
||||
fs-err = { version = "3.0.0", features = ["tokio"] }
|
||||
|
||||
|
@ -86,7 +86,6 @@ dirs = { version = "5.0.1", optional = true }
|
|||
tracing-subscriber = { version = "0.3.19", features = ["env-filter"], optional = true }
|
||||
indicatif = { version = "0.17.9", optional = true }
|
||||
inquire = { version = "0.7.5", optional = true }
|
||||
tempfile = { version = "3.14.0", optional = true }
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
winreg = { version = "0.52.0", optional = true }
|
||||
|
|
|
@ -14,8 +14,8 @@ use anyhow::Context;
|
|||
use colored::Colorize;
|
||||
use fs_err::tokio as fs;
|
||||
use pesde::{
|
||||
download_and_link::{filter_graph, DownloadAndLinkHooks, DownloadAndLinkOptions},
|
||||
graph::{ConvertableGraph, DependencyGraph, DownloadedGraph},
|
||||
download_and_link::{DownloadAndLinkHooks, DownloadAndLinkOptions},
|
||||
graph::{DependencyGraph, DownloadedGraph},
|
||||
lockfile::Lockfile,
|
||||
manifest::{target::TargetKind, DependencyType},
|
||||
Project, RefreshedSources, LOCKFILE_FILE_NAME, MANIFEST_FILE_NAME,
|
||||
|
@ -258,11 +258,17 @@ pub async fn install(
|
|||
bin_folder: bin_dir().await?,
|
||||
};
|
||||
|
||||
#[allow(unused_variables)]
|
||||
let downloaded_graph = project
|
||||
.download_and_link(
|
||||
&graph,
|
||||
DownloadAndLinkOptions::<CliReporter, InstallHooks>::new(reqwest.clone())
|
||||
.reporter(reporter.clone())
|
||||
.reporter(
|
||||
#[cfg(feature = "patches")]
|
||||
reporter.clone(),
|
||||
#[cfg(not(feature = "patches"))]
|
||||
reporter,
|
||||
)
|
||||
.hooks(hooks)
|
||||
.refreshed_sources(refreshed_sources)
|
||||
.prod(options.prod)
|
||||
|
@ -274,6 +280,8 @@ pub async fn install(
|
|||
|
||||
#[cfg(feature = "patches")]
|
||||
if options.write {
|
||||
use pesde::{download_and_link::filter_graph, graph::ConvertableGraph};
|
||||
|
||||
root_progress.reset();
|
||||
root_progress.set_length(0);
|
||||
root_progress.set_message("patch");
|
||||
|
|
|
@ -11,9 +11,7 @@ use pesde::{
|
|||
},
|
||||
names::{PackageName, PackageNames},
|
||||
source::{
|
||||
ids::{PackageId, VersionId},
|
||||
specifiers::DependencySpecifiers,
|
||||
workspace::specifier::VersionTypeOrReq,
|
||||
ids::VersionId, specifiers::DependencySpecifiers, workspace::specifier::VersionTypeOrReq,
|
||||
},
|
||||
Project,
|
||||
};
|
||||
|
@ -165,7 +163,10 @@ impl<V: FromStr<Err = E>, E: Into<anyhow::Error>, N: FromStr<Err = F>, F: Into<a
|
|||
|
||||
impl VersionedPackageName {
|
||||
#[cfg(feature = "patches")]
|
||||
fn get(self, graph: &pesde::graph::DependencyGraph) -> anyhow::Result<PackageId> {
|
||||
fn get(
|
||||
self,
|
||||
graph: &pesde::graph::DependencyGraph,
|
||||
) -> anyhow::Result<pesde::source::ids::PackageId> {
|
||||
let version_id = match self.1 {
|
||||
Some(version) => version,
|
||||
None => {
|
||||
|
@ -189,7 +190,7 @@ impl VersionedPackageName {
|
|||
}
|
||||
};
|
||||
|
||||
Ok(PackageId::new(self.0, version_id))
|
||||
Ok(pesde::source::ids::PackageId::new(self.0, version_id))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
use crate::{
|
||||
deser_manifest,
|
||||
manifest::{
|
||||
target::{Target, TargetKind},
|
||||
Manifest,
|
||||
},
|
||||
manifest::{target::Target, Manifest},
|
||||
names::PackageNames,
|
||||
reporters::DownloadProgressReporter,
|
||||
source::{
|
||||
|
@ -12,7 +9,6 @@ use crate::{
|
|||
git_index::{read_file, GitBasedSource},
|
||||
specifiers::DependencySpecifiers,
|
||||
traits::{DownloadOptions, GetTargetOptions, PackageRef, RefreshOptions, ResolveOptions},
|
||||
wally::compat_util::get_target,
|
||||
PackageSource, ResolveResult, VersionId, IGNORED_DIRS, IGNORED_FILES,
|
||||
},
|
||||
util::hash,
|
||||
|
@ -266,43 +262,43 @@ impl PackageSource for GitPackageSource {
|
|||
|
||||
#[cfg(feature = "wally-compat")]
|
||||
None => {
|
||||
match read_file(
|
||||
&tree,
|
||||
[crate::source::wally::compat_util::WALLY_MANIFEST_FILE_NAME],
|
||||
)
|
||||
.map_err(|e| {
|
||||
use crate::{
|
||||
manifest::target::TargetKind,
|
||||
source::wally::{
|
||||
compat_util::WALLY_MANIFEST_FILE_NAME,
|
||||
manifest::{Realm, WallyManifest},
|
||||
},
|
||||
};
|
||||
|
||||
match read_file(&tree, [WALLY_MANIFEST_FILE_NAME]).map_err(|e| {
|
||||
errors::ResolveError::ReadManifest(Box::new(self.repo_url.clone()), e)
|
||||
})? {
|
||||
Some(m) => {
|
||||
match toml::from_str::<crate::source::wally::manifest::WallyManifest>(&m) {
|
||||
Ok(manifest) => {
|
||||
let dependencies = manifest.all_dependencies().map_err(|e| {
|
||||
errors::ResolveError::CollectDependencies(
|
||||
Box::new(self.repo_url.clone()),
|
||||
e,
|
||||
)
|
||||
})?;
|
||||
let name = PackageNames::Wally(manifest.package.name);
|
||||
let version_id = VersionId(
|
||||
manifest.package.version,
|
||||
match manifest.package.realm {
|
||||
crate::source::wally::manifest::Realm::Server => {
|
||||
TargetKind::RobloxServer
|
||||
}
|
||||
_ => TargetKind::Roblox,
|
||||
},
|
||||
);
|
||||
|
||||
(name, version_id, dependencies)
|
||||
}
|
||||
Err(e) => {
|
||||
return Err(errors::ResolveError::DeserManifest(
|
||||
Some(m) => match toml::from_str::<WallyManifest>(&m) {
|
||||
Ok(manifest) => {
|
||||
let dependencies = manifest.all_dependencies().map_err(|e| {
|
||||
errors::ResolveError::CollectDependencies(
|
||||
Box::new(self.repo_url.clone()),
|
||||
e,
|
||||
))
|
||||
}
|
||||
)
|
||||
})?;
|
||||
let name = PackageNames::Wally(manifest.package.name);
|
||||
let version_id = VersionId(
|
||||
manifest.package.version,
|
||||
match manifest.package.realm {
|
||||
Realm::Server => TargetKind::RobloxServer,
|
||||
_ => TargetKind::Roblox,
|
||||
},
|
||||
);
|
||||
|
||||
(name, version_id, dependencies)
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
return Err(errors::ResolveError::DeserManifest(
|
||||
Box::new(self.repo_url.clone()),
|
||||
e,
|
||||
))
|
||||
}
|
||||
},
|
||||
None => {
|
||||
return Err(errors::ResolveError::NoManifest(Box::new(
|
||||
self.repo_url.clone(),
|
||||
|
@ -509,19 +505,22 @@ impl PackageSource for GitPackageSource {
|
|||
#[instrument(skip_all, level = "debug")]
|
||||
async fn get_target(
|
||||
&self,
|
||||
_pkg_ref: &Self::Ref,
|
||||
pkg_ref: &Self::Ref,
|
||||
options: &GetTargetOptions,
|
||||
) -> Result<Target, Self::GetTargetError> {
|
||||
match deser_manifest(&options.path).await {
|
||||
Ok(manifest) => Ok(manifest.target),
|
||||
if !pkg_ref.new_structure {
|
||||
#[cfg(feature = "wally-compat")]
|
||||
Err(crate::errors::ManifestReadError::Io(e))
|
||||
if e.kind() == std::io::ErrorKind::NotFound =>
|
||||
{
|
||||
get_target(options).await.map_err(Into::into)
|
||||
}
|
||||
Err(e) => Err(e.into()),
|
||||
return crate::source::wally::compat_util::get_target(options)
|
||||
.await
|
||||
.map_err(Into::into);
|
||||
#[cfg(not(feature = "wally-compat"))]
|
||||
panic!("wally-compat feature is not enabled, and package is a wally package");
|
||||
}
|
||||
|
||||
deser_manifest(&options.path)
|
||||
.await
|
||||
.map(|m| m.target)
|
||||
.map_err(Into::into)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -297,6 +297,7 @@ impl PackageSource for PesdePackageSource {
|
|||
options: &GetTargetOptions,
|
||||
) -> Result<Target, Self::GetTargetError> {
|
||||
let GetTargetOptions { id, .. } = options;
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
let PackageNames::Pesde(name) = id.name() else {
|
||||
panic!("unexpected package name");
|
||||
};
|
||||
|
|
|
@ -50,6 +50,7 @@ pub fn deserialize_gix_url_map<'de, D: Deserializer<'de>>(
|
|||
.collect()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn deserialize_gix_url_vec<'de, D: Deserializer<'de>>(
|
||||
deserializer: D,
|
||||
) -> Result<Vec<gix::Url>, D::Error> {
|
||||
|
|
Loading…
Add table
Reference in a new issue