Add a lock target abstraction (#10129)

## Summary

This PR introduces a `LockTarget`, which is peer to `InstallTarget` and
enables us to capture the common functionality necessary to support
locking.

For now, to minimize changes, only the `Workspace` target is
implemented. In a future PR, I'll add a `Script` target for both locking
and installing.
This commit is contained in:
Charlie Marsh 2024-12-24 19:26:31 -05:00 committed by GitHub
parent 7c47a457d9
commit f872b56124
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 329 additions and 194 deletions

View file

@ -278,7 +278,7 @@ impl Workspace {
.any(|member| *member.root() == self.install_path)
}
/// Returns the set of requirements that include all packages in the workspace.
/// Returns the set of all workspace members.
pub fn members_requirements(&self) -> impl Iterator<Item = Requirement> + '_ {
self.packages.values().filter_map(|member| {
let url = VerbatimUrl::from_absolute_path(&member.root)
@ -309,7 +309,7 @@ impl Workspace {
})
}
/// Returns the set of requirements that include all packages in the workspace.
/// Returns the set of all workspace member dependency groups.
pub fn group_requirements(&self) -> impl Iterator<Item = Requirement> + '_ {
self.packages.values().filter_map(|member| {
let url = VerbatimUrl::from_absolute_path(&member.root)