Skip to content

initial integration of registry dependencies #3863

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

Merged
merged 5 commits into from
Nov 15, 2021

Conversation

tomerd
Copy link
Contributor

@tomerd tomerd commented Nov 11, 2021

motivation: support registry dependencies

changes:

  • make PinStore::state more generic (instead of CheckoutState) so it can handle non-checkout dependencies state
  • clean up CheckoutState and move it to the Workspace module where it belongs
  • wire calls to fetch and delete registry dependencies as part of dependency resolution in Workspace
  • adjust call-sites tests

@tomerd
Copy link
Contributor Author

tomerd commented Nov 11, 2021

@swift-ci please smoke test

@tomerd tomerd requested review from yim-lee and mattt November 11, 2021 23:20
@tomerd
Copy link
Contributor Author

tomerd commented Nov 12, 2021

@swift-ci please smoke test

Copy link
Contributor

@yim-lee yim-lee left a comment

Choose a reason for hiding this comment

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

  • Do we need both CheckoutState and PinState?
  • The code around PinState seems repetitive (e.g., there are two PinStateInfo) but not sure if it can be DRYer.

@@ -272,6 +314,9 @@ fileprivate struct PinsStorage {
case .remoteSourceControl(let url):
kind = .remoteSourceControl
location = url.absoluteString
case .registry:
kind = .registry
location = ""
Copy link
Contributor

Choose a reason for hiding this comment

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

nil is more appropriate but it's probably a big change to make location optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I will also add a FIXME here as we may need to revisit this

let downloadPath = self.location.registryDownloadDirectory.appending(components: package.identity.description, version.description)
if !self.fileSystem.exists(downloadPath) {
_ = try temp_await {
registryManager.downloadSourceArchive(
Copy link
Contributor

Choose a reason for hiding this comment

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

@tomerd
Copy link
Contributor Author

tomerd commented Nov 12, 2021

@swift-ci please smoke test

@tomerd tomerd force-pushed the feature/registry-01 branch from f2db564 to d291a81 Compare November 13, 2021 02:25
@tomerd
Copy link
Contributor Author

tomerd commented Nov 13, 2021

@swift-ci please smoke test

@tomerd tomerd added the ready Author believes the PR is ready to be merged & any feedback has been addressed label Nov 13, 2021
@tomerd
Copy link
Contributor Author

tomerd commented Nov 13, 2021

@yim-lee rebased on your changes ptal

@@ -135,9 +134,9 @@ public final class RegistryManager {
var components = URLComponents(url: registry.url, resolvingAgainstBaseURL: true)
components?.appendPathComponents("\(scope)", "\(name)", "\(version)", "Package.swift")

if let swiftLanguageVersion = swiftLanguageVersion {
if let toolsVersion = toolsVersion {
Copy link
Contributor

Choose a reason for hiding this comment

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

So it's the tools version, not Swift version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it should be tools version based afaik

@@ -185,7 +184,7 @@ public final class RegistryManager {
packageLocation: package.description, // FIXME: was originally PackageReference.locationString
version: version,
revision: nil,
toolsVersion: .currentToolsVersion,
toolsVersion: toolsVersion ?? .currentToolsVersion,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove the FIXME on L180 then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is still not working quite right, and looks like it may require larger change :/

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

@@ -157,20 +164,20 @@ final class RegistryManagerTests: XCTestCase {

// FIXME: this fails with error "the package manifest at '/Package.swift' cannot be accessed (/Package.swift doesn't exist in file system)"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we uncomment the test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tried to fix it but this is still not working correctly. i plan to address in a separate pr to control scope of this one

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

}

try temp_await {
registryManager.downloadSourceArchive(
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

motivation: support registry dependencies

changes:
* make PinStore::state more generic (instead of CheckoutState) so it can handle non-checkout dependencies state
* clean up CheckoutState and move it to the Workspace module where it belongs
* wire calls to fetch and delete registry dependencies as part of dependency resolution in Workspace
* adjust call-sites tests
@tomerd tomerd force-pushed the feature/registry-01 branch from 7105157 to 5f99c14 Compare November 15, 2021 19:39
@tomerd tomerd force-pushed the feature/registry-01 branch from 5f99c14 to e0e29cf Compare November 15, 2021 19:40
@tomerd
Copy link
Contributor Author

tomerd commented Nov 15, 2021

@swift-ci please smoke test

@neonichu neonichu merged commit 9e9fab2 into swiftlang:main Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready Author believes the PR is ready to be merged & any feedback has been addressed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants