Skip to content

Update to new SwiftPM Workspace initializer #458

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 1 commit into from
Feb 18, 2022

Conversation

benlangmuir
Copy link
Contributor

No description provided.

@benlangmuir
Copy link
Contributor Author

@tomerd this adopts the new "customToolchain" parameter to the Workspace that you added. I had to remove our customMirrors setup, because I didn't see a public initializer that takes both customMirrors and customToolchain. Maybe we should add customMirrors to this newer initializer?

I'm also not completely clear how our mirrors setup differs from the default. The last comment on this from you #427 (comment) implied that we still need it. Is that still true? The default implementation of mirrors looks reasonable to me, but it's a bit hard to trace through exactly how it would differ from what we're currently doing.

@benlangmuir benlangmuir requested a review from tomerd February 14, 2022 18:11
sharedMirrorFile: location.sharedMirrorsConfigurationFile,
fileSystem: fileSystem
)
let configuration = WorkspaceConfiguration(
Copy link
Contributor

@tomerd tomerd Feb 16, 2022

Choose a reason for hiding this comment

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

var configuration = WorkspaceConfiguration.default
configuration.skipDependenciesUpdates: true // <-- example of customization of the default

potentially more future facing support of defaults

resolverUpdateEnabled: false
configuration: configuration,
customHostToolchain: toolchain,
customManifestLoader: ManifestLoader(toolchain: toolchain.configuration, cacheDir: location.workingDirectory)
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we still need a custom manifest loader now that we are providing a custom toolchain.

ManifestLoader has only two argument: the toolchain (which we now provide explicitly) and the cacheDir. I think in the case of LSP we can use the default SwiftPM cache dir so that would mean we can just drop this argument.

@tomerd
Copy link
Contributor

tomerd commented Feb 16, 2022

looks good. some ideas inline

@tomerd
Copy link
Contributor

tomerd commented Feb 16, 2022

I'm also not completely clear how our mirrors setup differs from the default. The last comment on this from you #427 (comment) implied that we still need it. Is that still true? The default implementation of mirrors looks reasonable to me, but it's a bit hard to trace through exactly how it would differ from what we're currently doing.

I think the way you have it is correct. the old initializers there was no link between the location and the mirrors, but that ws part of the changes that led up to the new initializers

* Pass in our custom toolchain
* Remove custom mirror config; swiftpm's default should now match our
  specified location.
* Remove custom manifest loader; swiftpm's default uses our toolchain
  and should work now.
@benlangmuir benlangmuir marked this pull request as ready for review February 16, 2022 21:21
@benlangmuir benlangmuir requested a review from ahoppen as a code owner February 16, 2022 21:21
@benlangmuir
Copy link
Contributor Author

Thanks @tomerd, updated based on your suggestions

@benlangmuir
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@tomerd tomerd left a comment

Choose a reason for hiding this comment

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

lgtm

@benlangmuir
Copy link
Contributor Author

@swift-ci please test

@shahmishal
Copy link
Member

@swift-ci please test Linux

@shahmishal
Copy link
Member

@swift-ci please test macOS

@ahoppen
Copy link
Member

ahoppen commented Feb 17, 2022

What did the mirrors configuration do? I looked inside the SwiftPM repo but couldn’t find any documentation on it.

@benlangmuir
Copy link
Contributor Author

benlangmuir commented Feb 17, 2022

It was added here: #299

I believe that it is no longer necessary (a) because the API we're using will do the right thing internally, and (b) we shouldn't be triggering updates anymore.

@tomerd
Copy link
Contributor

tomerd commented Feb 18, 2022

correct, we now have SwiftPM handle this detail internally base on the Location that is provided by the client, and in this case (most cases) initialized to the the package root

@benlangmuir benlangmuir merged commit d4a4564 into swiftlang:main Feb 18, 2022
@benlangmuir benlangmuir deleted the update-swiftpm-init branch February 18, 2022 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants