mirror of
https://github.com/pesde-pkg/pesde.git
synced 2024-12-12 11:00:36 +00:00
fix: correctly link Wally server packages
This commit is contained in:
parent
4965d172be
commit
be46042b51
15 changed files with 49 additions and 84 deletions
|
@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
### Fixed
|
||||
- Correctly link Wally server packages by @daimond113
|
||||
|
||||
## [0.5.0-rc.8] - 2024-11-12
|
||||
### Added
|
||||
- Add `--index` flag to `publish` command to publish to a specific index by @daimond113
|
||||
|
|
|
@ -4,7 +4,6 @@ use clap::Args;
|
|||
use pesde::{
|
||||
linking::generator::generate_bin_linking_module,
|
||||
names::{PackageName, PackageNames},
|
||||
source::traits::PackageRef,
|
||||
Project, PACKAGES_CONTAINER_NAME,
|
||||
};
|
||||
use relative_path::RelativePathBuf;
|
||||
|
@ -87,7 +86,7 @@ impl RunCommand {
|
|||
.await?
|
||||
.target
|
||||
.kind()
|
||||
.packages_folder(&node.node.pkg_ref.target_kind());
|
||||
.packages_folder(version_id.target());
|
||||
let container_folder = node.node.container_folder(
|
||||
&project
|
||||
.package_dir()
|
||||
|
|
|
@ -72,7 +72,7 @@ impl Project {
|
|||
|
||||
let container_folder = node.container_folder(
|
||||
&package_dir
|
||||
.join(manifest_target_kind.packages_folder(&node.pkg_ref.target_kind()))
|
||||
.join(manifest_target_kind.packages_folder(version_id.target()))
|
||||
.join(PACKAGES_CONTAINER_NAME),
|
||||
&name,
|
||||
version_id.version(),
|
||||
|
|
|
@ -51,12 +51,7 @@ impl Project {
|
|||
let container_folder = node.node.container_folder(
|
||||
&self
|
||||
.package_dir()
|
||||
.join(
|
||||
manifest
|
||||
.target
|
||||
.kind()
|
||||
.packages_folder(&node.node.pkg_ref.target_kind()),
|
||||
)
|
||||
.join(manifest.target.kind().packages_folder(version_id.target()))
|
||||
.join(PACKAGES_CONTAINER_NAME),
|
||||
name,
|
||||
version_id.version(),
|
||||
|
@ -130,12 +125,8 @@ impl Project {
|
|||
for (version_id, node) in versions {
|
||||
let (node_container_folder, node_packages_folder) = {
|
||||
let base_folder = create_and_canonicalize(
|
||||
self.package_dir().join(
|
||||
manifest
|
||||
.target
|
||||
.kind()
|
||||
.packages_folder(&node.node.pkg_ref.target_kind()),
|
||||
),
|
||||
self.package_dir()
|
||||
.join(manifest.target.kind().packages_folder(version_id.target())),
|
||||
)
|
||||
.await?;
|
||||
let packages_container_folder = base_folder.join(PACKAGES_CONTAINER_NAME);
|
||||
|
@ -214,10 +205,9 @@ impl Project {
|
|||
|
||||
let base_folder = create_and_canonicalize(
|
||||
self.package_dir().join(
|
||||
node.node
|
||||
.pkg_ref
|
||||
.target_kind()
|
||||
.packages_folder(&dependency_node.node.pkg_ref.target_kind()),
|
||||
version_id
|
||||
.target()
|
||||
.packages_folder(dependency_version_id.target()),
|
||||
),
|
||||
)
|
||||
.await?;
|
||||
|
@ -230,8 +220,10 @@ impl Project {
|
|||
);
|
||||
|
||||
let linker_folder = create_and_canonicalize(
|
||||
node_container_folder
|
||||
.join(node.node.base_folder(dependency_node.target.kind())),
|
||||
node_container_folder.join(
|
||||
node.node
|
||||
.base_folder(version_id, dependency_node.target.kind()),
|
||||
),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
|
|
@ -37,9 +37,9 @@ pub struct DependencyGraphNode {
|
|||
}
|
||||
|
||||
impl DependencyGraphNode {
|
||||
pub(crate) fn base_folder(&self, project_target: TargetKind) -> String {
|
||||
pub(crate) fn base_folder(&self, version_id: &VersionId, project_target: TargetKind) -> String {
|
||||
if self.pkg_ref.use_new_structure() {
|
||||
self.pkg_ref.target_kind().packages_folder(&project_target)
|
||||
version_id.target().packages_folder(&project_target)
|
||||
} else {
|
||||
"..".to_string()
|
||||
}
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
use crate::{
|
||||
lockfile::DownloadedGraph, source::traits::PackageRef, Project, MANIFEST_FILE_NAME,
|
||||
PACKAGES_CONTAINER_NAME,
|
||||
};
|
||||
use crate::{lockfile::DownloadedGraph, Project, MANIFEST_FILE_NAME, PACKAGES_CONTAINER_NAME};
|
||||
use fs_err::tokio as fs;
|
||||
use git2::{ApplyLocation, Diff, DiffFormat, DiffLineType, Repository, Signature};
|
||||
use relative_path::RelativePathBuf;
|
||||
|
@ -110,12 +107,7 @@ impl Project {
|
|||
let container_folder = node.node.container_folder(
|
||||
&self
|
||||
.package_dir()
|
||||
.join(
|
||||
manifest
|
||||
.target
|
||||
.kind()
|
||||
.packages_folder(&node.node.pkg_ref.target_kind()),
|
||||
)
|
||||
.join(manifest.target.kind().packages_folder(version_id.target()))
|
||||
.join(PACKAGES_CONTAINER_NAME),
|
||||
&name,
|
||||
version_id.version(),
|
||||
|
|
|
@ -328,7 +328,7 @@ impl Project {
|
|||
.chain(std::iter::once(alias.to_string()))
|
||||
.collect(),
|
||||
overridden.is_some(),
|
||||
pkg_ref.target_kind(),
|
||||
*target_version_id.target(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -272,8 +272,15 @@ impl PackageSource for GitPackageSource {
|
|||
)
|
||||
})?;
|
||||
let name = PackageNames::Wally(manifest.package.name);
|
||||
let version_id =
|
||||
VersionId(manifest.package.version, TargetKind::Roblox);
|
||||
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)
|
||||
}
|
||||
|
@ -300,7 +307,6 @@ impl PackageSource for GitPackageSource {
|
|||
}
|
||||
};
|
||||
|
||||
let target = *version_id.target();
|
||||
let new_structure = matches!(name, PackageNames::Pesde(_));
|
||||
|
||||
Ok((
|
||||
|
@ -310,7 +316,6 @@ impl PackageSource for GitPackageSource {
|
|||
GitPackageRef {
|
||||
repo: self.repo_url.clone(),
|
||||
tree_id: tree.id.to_string(),
|
||||
target,
|
||||
new_structure,
|
||||
dependencies,
|
||||
},
|
||||
|
@ -333,10 +338,9 @@ impl PackageSource for GitPackageSource {
|
|||
match fs::read_to_string(&index_file).await {
|
||||
Ok(s) => {
|
||||
log::debug!(
|
||||
"using cached index file for package {}#{} {}",
|
||||
"using cached index file for package {}#{}",
|
||||
pkg_ref.repo,
|
||||
pkg_ref.tree_id,
|
||||
pkg_ref.target
|
||||
pkg_ref.tree_id
|
||||
);
|
||||
|
||||
let fs = toml::from_str::<PackageFS>(&s).map_err(|e| {
|
||||
|
|
|
@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};
|
|||
use std::collections::BTreeMap;
|
||||
|
||||
use crate::{
|
||||
manifest::{target::TargetKind, DependencyType},
|
||||
manifest::DependencyType,
|
||||
source::{git::GitPackageSource, DependencySpecifiers, PackageRef, PackageSources},
|
||||
};
|
||||
|
||||
|
@ -22,8 +22,6 @@ pub struct GitPackageRef {
|
|||
pub dependencies: BTreeMap<String, (DependencySpecifiers, DependencyType)>,
|
||||
/// Whether this package uses the new structure
|
||||
pub new_structure: bool,
|
||||
/// The target of the package
|
||||
pub target: TargetKind,
|
||||
}
|
||||
impl PackageRef for GitPackageRef {
|
||||
fn dependencies(&self) -> &BTreeMap<String, (DependencySpecifiers, DependencyType)> {
|
||||
|
@ -34,10 +32,6 @@ impl PackageRef for GitPackageRef {
|
|||
self.new_structure
|
||||
}
|
||||
|
||||
fn target_kind(&self) -> TargetKind {
|
||||
self.target
|
||||
}
|
||||
|
||||
fn source(&self) -> PackageSources {
|
||||
PackageSources::Git(GitPackageSource::new(self.repo.clone()))
|
||||
}
|
||||
|
|
|
@ -4,10 +4,7 @@ use semver::Version;
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
manifest::{
|
||||
target::{Target, TargetKind},
|
||||
DependencyType,
|
||||
},
|
||||
manifest::{target::Target, DependencyType},
|
||||
names::PackageName,
|
||||
source::{pesde::PesdePackageSource, DependencySpecifiers, PackageRef, PackageSources},
|
||||
};
|
||||
|
@ -40,10 +37,6 @@ impl PackageRef for PesdePackageRef {
|
|||
true
|
||||
}
|
||||
|
||||
fn target_kind(&self) -> TargetKind {
|
||||
self.target.kind()
|
||||
}
|
||||
|
||||
fn source(&self) -> PackageSources {
|
||||
PackageSources::Pesde(PesdePackageSource::new(self.index_url.clone()))
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{
|
||||
manifest::{target::TargetKind, DependencyType},
|
||||
manifest::DependencyType,
|
||||
source::{pesde, specifiers::DependencySpecifiers, traits::PackageRef, PackageSources},
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -53,16 +53,6 @@ impl PackageRef for PackageRefs {
|
|||
}
|
||||
}
|
||||
|
||||
fn target_kind(&self) -> TargetKind {
|
||||
match self {
|
||||
PackageRefs::Pesde(pkg_ref) => pkg_ref.target_kind(),
|
||||
#[cfg(feature = "wally-compat")]
|
||||
PackageRefs::Wally(pkg_ref) => pkg_ref.target_kind(),
|
||||
PackageRefs::Git(pkg_ref) => pkg_ref.target_kind(),
|
||||
PackageRefs::Workspace(pkg_ref) => pkg_ref.target_kind(),
|
||||
}
|
||||
}
|
||||
|
||||
fn source(&self) -> PackageSources {
|
||||
match self {
|
||||
PackageRefs::Pesde(pkg_ref) => pkg_ref.source(),
|
||||
|
|
|
@ -22,8 +22,6 @@ pub trait PackageRef: Debug {
|
|||
fn dependencies(&self) -> &BTreeMap<String, (DependencySpecifiers, DependencyType)>;
|
||||
/// Whether to use the new structure (`packages` folders inside the package's content folder) or the old structure (Wally-style, with linker files in the parent of the folder containing the package's contents)
|
||||
fn use_new_structure(&self) -> bool;
|
||||
/// The target of this package
|
||||
fn target_kind(&self) -> TargetKind;
|
||||
/// The source of this package
|
||||
fn source(&self) -> PackageSources;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,11 @@ use crate::{
|
|||
git_index::{read_file, root_tree, GitBasedSource},
|
||||
traits::PackageSource,
|
||||
version_id::VersionId,
|
||||
wally::{compat_util::get_target, manifest::WallyManifest, pkg_ref::WallyPackageRef},
|
||||
wally::{
|
||||
compat_util::get_target,
|
||||
manifest::{Realm, WallyManifest},
|
||||
pkg_ref::WallyPackageRef,
|
||||
},
|
||||
IGNORED_DIRS, IGNORED_FILES,
|
||||
},
|
||||
util::hash,
|
||||
|
@ -125,7 +129,13 @@ impl PackageSource for WallyPackageSource {
|
|||
.filter(|manifest| specifier.version.matches(&manifest.package.version))
|
||||
.map(|manifest| {
|
||||
Ok((
|
||||
VersionId(manifest.package.version.clone(), TargetKind::Roblox),
|
||||
VersionId(
|
||||
manifest.package.version.clone(),
|
||||
match manifest.package.realm {
|
||||
Realm::Server => TargetKind::RobloxServer,
|
||||
_ => TargetKind::Roblox,
|
||||
},
|
||||
),
|
||||
WallyPackageRef {
|
||||
name: specifier.name.clone(),
|
||||
index_url: self.repo_url.clone(),
|
||||
|
|
|
@ -4,7 +4,7 @@ use semver::Version;
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
manifest::{target::TargetKind, DependencyType},
|
||||
manifest::DependencyType,
|
||||
names::wally::WallyPackageName,
|
||||
source::{wally::WallyPackageSource, DependencySpecifiers, PackageRef, PackageSources},
|
||||
};
|
||||
|
@ -36,10 +36,6 @@ impl PackageRef for WallyPackageRef {
|
|||
false
|
||||
}
|
||||
|
||||
fn target_kind(&self) -> TargetKind {
|
||||
TargetKind::Roblox
|
||||
}
|
||||
|
||||
fn source(&self) -> PackageSources {
|
||||
PackageSources::Wally(WallyPackageSource::new(self.index_url.clone()))
|
||||
}
|
||||
|
|
|
@ -3,10 +3,7 @@ use serde::{Deserialize, Serialize};
|
|||
use std::collections::BTreeMap;
|
||||
|
||||
use crate::{
|
||||
manifest::{
|
||||
target::{Target, TargetKind},
|
||||
DependencyType,
|
||||
},
|
||||
manifest::{target::Target, DependencyType},
|
||||
source::{workspace::WorkspacePackageSource, DependencySpecifiers, PackageRef, PackageSources},
|
||||
};
|
||||
|
||||
|
@ -30,10 +27,6 @@ impl PackageRef for WorkspacePackageRef {
|
|||
true
|
||||
}
|
||||
|
||||
fn target_kind(&self) -> TargetKind {
|
||||
self.target.kind()
|
||||
}
|
||||
|
||||
fn source(&self) -> PackageSources {
|
||||
PackageSources::Workspace(WorkspacePackageSource)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue