mirror of
https://github.com/pesde-pkg/pesde.git
synced 2024-12-12 11:00:36 +00:00
fix: use workspace specifiers target field
This commit is contained in:
parent
6c76a21b14
commit
1c2a232aba
2 changed files with 11 additions and 4 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/),
|
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).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
### Fixed
|
||||||
|
- Use workspace specifiers' `target` field when resolving by @daimond113
|
||||||
|
|
||||||
## [0.5.0-rc.2] - 2024-10-06
|
## [0.5.0-rc.2] - 2024-10-06
|
||||||
### Added
|
### Added
|
||||||
- Add support for multiple targets under the same package name in workspace members by @daimond113
|
- Add support for multiple targets under the same package name in workspace members by @daimond113
|
||||||
|
|
|
@ -36,22 +36,24 @@ impl PackageSource for WorkspacePackageSource {
|
||||||
&self,
|
&self,
|
||||||
specifier: &Self::Specifier,
|
specifier: &Self::Specifier,
|
||||||
project: &Project,
|
project: &Project,
|
||||||
_package_target: TargetKind,
|
package_target: TargetKind,
|
||||||
) -> Result<ResolveResult<Self::Ref>, Self::ResolveError> {
|
) -> Result<ResolveResult<Self::Ref>, Self::ResolveError> {
|
||||||
let (path, manifest) = 'finder: {
|
let (path, manifest) = 'finder: {
|
||||||
let workspace_dir = project
|
let workspace_dir = project
|
||||||
.workspace_dir
|
.workspace_dir
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.unwrap_or(&project.package_dir);
|
.unwrap_or(&project.package_dir);
|
||||||
|
let target = specifier.target.unwrap_or(package_target);
|
||||||
|
|
||||||
for (path, manifest) in project.workspace_members(workspace_dir)? {
|
for (path, manifest) in project.workspace_members(workspace_dir)? {
|
||||||
if manifest.name == specifier.name {
|
if manifest.name == specifier.name && manifest.target.kind() == target {
|
||||||
break 'finder (path, manifest);
|
break 'finder (path, manifest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Err(errors::ResolveError::NoWorkspaceMember(
|
return Err(errors::ResolveError::NoWorkspaceMember(
|
||||||
specifier.name.to_string(),
|
specifier.name.to_string(),
|
||||||
|
target,
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -134,6 +136,7 @@ impl PackageSource for WorkspacePackageSource {
|
||||||
|
|
||||||
/// Errors that can occur when using a workspace package source
|
/// Errors that can occur when using a workspace package source
|
||||||
pub mod errors {
|
pub mod errors {
|
||||||
|
use crate::manifest::target::TargetKind;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
/// Errors that can occur when refreshing the workspace package source
|
/// Errors that can occur when refreshing the workspace package source
|
||||||
|
@ -150,8 +153,8 @@ pub mod errors {
|
||||||
ReadWorkspaceMembers(#[from] crate::errors::WorkspaceMembersError),
|
ReadWorkspaceMembers(#[from] crate::errors::WorkspaceMembersError),
|
||||||
|
|
||||||
/// No workspace member was found with the given name
|
/// No workspace member was found with the given name
|
||||||
#[error("no workspace member found with name {0}")]
|
#[error("no workspace member found with name {0} and target {1}")]
|
||||||
NoWorkspaceMember(String),
|
NoWorkspaceMember(String, TargetKind),
|
||||||
|
|
||||||
/// An error occurred getting all dependencies
|
/// An error occurred getting all dependencies
|
||||||
#[error("failed to get all dependencies")]
|
#[error("failed to get all dependencies")]
|
||||||
|
|
Loading…
Reference in a new issue