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