Skip to content

[NFC] Move manifests-related code to Workspace+Manifests.swift #7000

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 2 commits into from
Oct 13, 2023

Conversation

MaxDesiatov
Copy link
Contributor

@MaxDesiatov MaxDesiatov commented Oct 13, 2023

Workspace.swift is currently at ~4600 LoC and has a risk of growing larger. It has become an assorted collection of stateful code, and splitting it into separate components should make it more manageable.

I started with manifests-related code, moving it to Workspace+Manifests.swift.

`Workspace.swift` is currently at ~4600 LoC and has a risk of growing larger. It has become an assorted collection of stateful code, and splitting it into separate components should make it more manageable.

I started with manifests-related code, moving it `Workspace+Manifests.swift`.
@MaxDesiatov MaxDesiatov added the no functional change No user-visible functional changes included label Oct 13, 2023
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test

@MaxDesiatov MaxDesiatov enabled auto-merge (squash) October 13, 2023 15:28
@MaxDesiatov MaxDesiatov merged commit 0cc531b into main Oct 13, 2023
@MaxDesiatov MaxDesiatov deleted the maxd/workspace-manifests branch October 13, 2023 17:17
MaxDesiatov added a commit that referenced this pull request Oct 23, 2023
### Motivation:

`Workspace.swift` has grown to an unmanageable size: ~4k lines, close to
4200 before #7000 was merged. The `Workspace` type is the main API for
SourceKit-LSP interactions with SwiftPM. As we'd like to add more
cross-compilation functionality here (e.g. allowing SourceKit-LSP to
select a different Swift SDK), this API should be more navigable and
easier to work with. Since the amount of `public` functions on
`Workspace` is limited, we should keep them grouped in the main
`Workspace.swift` file, but the actual implementations can be moved to
separate files for easier subsequent refactoring and further changes.

### Modifications:

Split `Workspace.swift` into more files, with each file corresponding to
an implementation aspect of the `Workspace` API.

Also applied our formatting rules to the new files.

### Result:

`Workspace.swift` is now only 1384 lines long. When looking for a
specific `Workspace` functionality implementation, you can look it up in
separate files that correspond to a larger area grouping that
functionality.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no functional change No user-visible functional changes included
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants