Skip to content

Implement dependency resolution through package registry #3640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 16 commits into from

Conversation

mattt
Copy link
Contributor

@mattt mattt commented Jul 29, 2021

This PR builds on top of #3635 to implement dependency resolution through a registry service.

Motivation:

Implement SE-0292.

Modifications:

  • Add PackageRegistry library and test target containing the RegistryManager client implementation.
  • Add RegistryPackageContainer class to PackageGraph module
  • Update Workspace to provide RegistryPackageContainer if the package is declared with a registry identifier (Currently WIP with hardcoded registry URL)
  • Update PubGrubDependencyResolver to support registry packages

Result:

With this change, Swift Package Manager will be able to resolve package dependencies through a configured registry service.

@mattt mattt force-pushed the package-registry-implementation branch from 1cdff33 to b8f0af0 Compare August 3, 2021 13:45
///
/// This is the root class for bridging the manifest & SCM systems into the
/// interfaces used by the `DependencyResolver` algorithm.
public class RepositoryPackageContainerProvider: PackageContainerProvider {
Copy link
Contributor Author

@mattt mattt Aug 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomerd @abertelrud After digging into the implementation a bit more, I hit a fork in the road and was interested to hear your ideas for how best to proceed.

Currently, responsibility for creating package containers falls to RepositoryPackageContainerProvider, which conforms to the PackageContainerProvider protocol.

My first instinct was to either create a complement to RepositoryPackageContainerProvider for registry packages, or to update that class to handle both repository and registry packages. However, I noticed that RepositoryPackageContainerProvider doesn't do much beyond copying some state from a Workspace and implementing the getContainer method requirement.

So my thinking here (73aa9bf) was that we could remove a layer of indirection by making Workspace conform to PackageContainerProvider directly. This way, we can access all of the information we need directly, (like registry configuration, netrc credentials, etc.).

Do you think this is the right approach to take?

@mattt mattt force-pushed the package-registry-implementation branch from c2b471c to c37e97d Compare August 4, 2021 13:47
@tomerd tomerd added the WIP Work in progress label Aug 19, 2021
@mattt mattt force-pushed the package-registry-implementation branch 2 times, most recently from bd3fefd to aed0139 Compare September 7, 2021 10:49
@mattt mattt force-pushed the package-registry-implementation branch from 0189c48 to a5ca10e Compare September 9, 2021 22:24
@tomerd

This comment has been minimized.

@mattt
Copy link
Contributor Author

mattt commented Sep 16, 2021

@tomerd Glad to see that we were thinking pretty much the same thing for ManagedDependency. I've rebased this PR against #3698 and opened a new PR with additional refactoring ideas in #3750.

@mattt mattt force-pushed the package-registry-implementation branch from b99d3bb to 2d76085 Compare September 17, 2021 18:44
tomerd and others added 13 commits September 29, 2021 00:32
motivation: make supporting registry depedencies easier

changes:
* rename LocalPackageContainer to FileSystemPackageContainer and move it to workspace module as internal struct
* rename RepositoryPackageContainer to SourceControlPackageContainer and move it to the workspace module as internal class
* remove RepositoryPackageContainerProvider and move its logic to workspace itself, including the logic to switch over dependecy type (local/remote) and providing the correct container type
* conform workspace to PackageContainerProvider and change getContiner call-sites to use it
* reorgnize repository related methods in a consistent manner so its easier to read the code that deals with repositories
* adjust call sites and tests

rdar://81621441
Add RegistryManagerTests
Add downloaded case to ManagedDependency.State

Update WorkspaceConfiguration serialization format to V5
@mattt mattt force-pushed the package-registry-implementation branch from 7ff0e54 to 35d9d9e Compare September 29, 2021 19:13
@mattt
Copy link
Contributor Author

mattt commented Sep 29, 2021

@tomerd I just finished rebasing this against your changes in #3766. Still some cleanup to do on my end, but resolution through a registry is working as of 35d9d9e.

@mattt mattt marked this pull request as ready for review September 30, 2021 20:37
@mattt
Copy link
Contributor Author

mattt commented Sep 30, 2021

@swift-ci Please smoke test

@mattt mattt marked this pull request as draft September 30, 2021 20:39
@mattt
Copy link
Contributor Author

mattt commented Sep 30, 2021

Back to draft to rebase on latest of main

@mattt mattt mentioned this pull request Oct 4, 2021
yim-lee added a commit to yim-lee/swift-package-manager that referenced this pull request Nov 12, 2021
Continue swiftlang#3640 and
polish up the registry client.
@yim-lee yim-lee mentioned this pull request Nov 12, 2021
yim-lee added a commit to yim-lee/swift-package-manager that referenced this pull request Nov 12, 2021
Continue swiftlang#3640 and
polish up the registry client.
yim-lee added a commit that referenced this pull request Nov 13, 2021
Continue #3640 and
polish up the registry client.
@tomerd
Copy link
Contributor

tomerd commented Nov 19, 2021

replaced by #3863 #3864 #3873 #3874

@tomerd tomerd closed this Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WIP Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants