Skip to content
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

Commands: enable the parseable module interface by default #5800

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented Oct 7, 2022

Enable the swift module interface to be emitted by default. This is helpful for API surface tracking and can potentially enable perusal of the swiftinterface in VSCode mirroring what XCode already permits.

@compnerd
Copy link
Member Author

compnerd commented Oct 7, 2022

@swift-ci please smoke test

@compnerd
Copy link
Member Author

compnerd commented Oct 7, 2022

CC: @artemcm

@artemcm artemcm requested a review from xymus October 7, 2022 16:12
@xymus
Copy link
Contributor

xymus commented Oct 10, 2022

CC @bnbarham As we've been considering generating more swiftinterfaces for our own tools too.

Copy link
Contributor

@xymus xymus left a comment

Choose a reason for hiding this comment

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

We've been considering such a change to feed the swiftinterfaces to more tools ourselves.

We may want to have something in the compiler to prevent (or warn) when building from a non-resilient swiftinterface if that becomes a problem.

@bnbarham
Copy link
Contributor

This is helpful for API surface tracking and can potentially enable perusal of the swiftinterface in VSCode mirroring what XCode already permits.

It's worth noting that Xcode doesn't use the .swiftinterface, but rather a "generated interface". It avoids printing underscored attributes, allows grouping APIs, synthesizes extensions, and prints comments. There's different entry points for a module/swift file/header - see eg. editorOpenInterface in Requests.cpp.

Having said that, as long as we avoid building from a .swiftinterface for non-resilient modules (which could just be a check of the args in the .swiftinterface), I don't see anything wrong with this change. If comments were added to the .swiftinterface perhaps we could also move towards removing .swiftdoc (and others?).

@compnerd
Copy link
Member Author

We may want to have something in the compiler to prevent (or warn) when building from a non-resilient swiftinterface if that becomes a problem.

This seems reasonable to me. @bnbarham would you be okay with this being deferred as @xymus suggested?

It's worth noting that Xcode doesn't use the .swiftinterface, but rather a "generated interface". It avoids printing underscored attributes, allows grouping APIs, synthesizes extensions, and prints comments. There's different entry points for a module/swift file/header - see eg. editorOpenInterface in Requests.cpp.

Oh, that is interesting. Unfortunately, I don't think that VSCode likes the idea of generating, and it would require some work to do that, though if that is already in the LSP ... we might be able to write that out and point VSCode to the on-disk representation. The other features of that seem like conveniences that would be appreciated by users.

@bnbarham
Copy link
Contributor

This seems reasonable to me. @bnbarham would you be okay with this being deferred as @xymus suggested?

That's fine with me. It shouldn't be an issue right now as we prefer swiftmodules. Just something to keep in mind going forward.

The other features of that seem like conveniences that would be appreciated by users.

I personally prefer the idea of using the swiftinterface and possibly unifying the other files into it.

Enable the swift module interface to be emitted by default.  This is
helpful for API surface tracking and can potentially enable perusal of
the swiftinterface in VSCode mirroring what XCode already permits.
@compnerd
Copy link
Member Author

@swift-ci please smoke test

@xymus
Copy link
Contributor

xymus commented Nov 2, 2022

I happened to add something that was missing for the compiler to be able to detect when building against a non-library-evolution enabled swiftinterface. So I went ahead and started working on reporting it: swiftlang/swift#61765

Note that there's still a warning when generating a swiftinterface for a non-libary-evolution module.

@neonichu
Copy link
Contributor

neonichu commented Nov 2, 2022

Note that there's still a warning when generating a swiftinterface for a non-libary-evolution module.

I think as long as that is the case, we can't really enable it by default.

@tomerd
Copy link
Contributor

tomerd commented Nov 2, 2022

cc @elsh in case this impact the ideas you are working on

@neonichu
Copy link
Contributor

@compnerd should we close this one?

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.

5 participants