GSoC Mechanically Editing Package.swift manifest File

Hi everyone,

I would really like to participate in Google's Summer of Code with Swift this year. Looking through the list of projects, the one about mechanically editing the Package.swift manifest file really caught my eye.

I have a few questions about it before I start writing a proposal. First, is there any reason we couldn't or shouldn't use libSyntax instead of SourceKit to edit the file? Second, what are the challenges that give this project an expected difficulty of hard? And lastly, could this functionality be extended to support other tools, such as the one proposed to suggest the next semver tag of a package?

Miguel Salinas

1 Like

Great! I am looking forward to your proposal.

I think, we should be using libSyntax for such a feature and it already has a Swift library called SwiftSyntax. However, libSyntax is not fully complete yet (though from the status page it looks like its pretty close). Using libSyntax may be a better choice than SourceKit but we should ensure it is technically feasible. @Xi_Ge @harlanhaskins can you folks comment on the status of SwiftSyntax and if it is the right fit for this feature?

The Package.swift allows package authors to use full power of the Swift language to write their manifest file. It might be difficult to write a tool which can edit complex manifest files. However, for the initial version, we should aim for editing simple manifests which are written using the suggested declarative syntax. You may need to deep dive into libSyntax/SourceKit to add some additional functionality. These tools are primarily written in C++ and may require learning some Swift compiler internals.

Absolutely, once SwiftPM gains ability of using these tools, we unlock path to several other features which can be built incrementally!

I talked with @Xi_Ge today, he also thinks SwiftSyntax is the right tool for mechanically editing Package.swift files. I think we should go in that direction. If there is any missing feature in SwiftSyntax that SwiftPM needs, we can implement that as long as it fits the general direction of SwiftSyntax/libSyntax.

That's correct. libSyntax provides us convenient APIs for analyzing and transforming Swift code in Swift. One can directly work on it by downloading existing toolchain without building the Swift compiler. Please see instructions in here.

Thanks for the responses! Definitely clears things up. I'll be working on my proposal!

Just submitted a draft proposal! Feedback would be greatly appreciated. Also, I had a couple of questions that I thought others might have as well.
First, if we are accepted, how should we expect this process be different than writing and implementing a proposal on the Github? (Besides having a mentor to help us through the process)
Second, and more specifically, should we expect to create a proposal on Github and hash out our project details with the community?