Skip to content

Allow -explicit-swift-module-map-file without full explicit module build #39887

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

Conversation

keith
Copy link
Member

@keith keith commented Oct 22, 2021

This enables the use of -explicit-swift-module-map-file for some
modules in the build, while still loading implicit modules as before.
This is useful to improve the performance of builds with many modules to
avoid searching many different directories pass with -I. Previously
VFS overlays could be used for this use case as well, but it seems
valuable to unify on the same infrastructure used for explicit module
builds.

This enables the use of `-explicit-swift-module-map-file` for some
modules in the build, while still loading implicit modules as before.
This is useful to improve the performance of builds with many modules to
avoid searching many different directories pass with `-I`. Previously
VFS overlays could be used for this use case as well, but it seems
valuable to unify on the same infrastructure used for explicit module
builds.
@kastiglione
Copy link
Contributor

This seems reasonable to me. I've added @nkcsgexi and @artemcm for review, as they authored the nearby code (#32903, #32170, #34121)

@kastiglione
Copy link
Contributor

@swift-ci test

Copy link
Contributor

@artemcm artemcm left a comment

Choose a reason for hiding this comment

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

This is a reasonable thing to do. LGTM!

Copy link
Contributor

@nkcsgexi nkcsgexi left a comment

Choose a reason for hiding this comment

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

I think this makes sense.

@nkcsgexi
Copy link
Contributor

nkcsgexi commented Dec 3, 2021

@artemcm thoughts on partially explicit module build?

@artemcm
Copy link
Contributor

artemcm commented Dec 3, 2021

@artemcm thoughts on partially explicit module build?

With the way the module loaders are ordered here, we should get exactly the behavior @keith outlined in the description. This isn't something we've tested, but I don't see why it would not work.

@keith
Copy link
Member Author

keith commented Dec 6, 2021

@artemcm @nkcsgexi thanks for the review, can this merge now?

@nkcsgexi nkcsgexi merged commit c0f7143 into swiftlang:main Dec 6, 2021
@keith keith deleted the ks/allow-explicit-swift-module-map-file-without-full-explicit-module-build branch December 6, 2021 20:02
@keith
Copy link
Member Author

keith commented Dec 6, 2021

Thanks!

keith added a commit to bazelbuild/rules_swift that referenced this pull request Feb 12, 2022
As of Swift 5.6 and this PR swiftlang/swift#39887
the new json format used for entirely explicit module builds can be used
without entirely disabling implicit modules. This provides an
alternative to VFS overlays for discovering dependencies without `-I`
search paths. This is theoretically about the same but I expect this
file format to have better support in general than VFS overlays for
things like the new incremental compilation support, which currently
doesn't support VFS overlays, and this shouldn't have any downsides vs
VFS files.

This format does support some more keys than just the 2 we pass, as far
as I can tell they are unused today, so I'm opting not to pass them. We
may have to revisit this in the future.
keith added a commit to bazelbuild/rules_swift that referenced this pull request Apr 25, 2022
As of Swift 5.6 and this PR swiftlang/swift#39887
the new json format used for entirely explicit module builds can be used
without entirely disabling implicit modules. This provides an
alternative to VFS overlays for discovering dependencies without `-I`
search paths. This is theoretically about the same but I expect this
file format to have better support in general than VFS overlays for
things like the new incremental compilation support, which currently
doesn't support VFS overlays, and this shouldn't have any downsides vs
VFS files.

This format does support some more keys than just the 2 we pass, as far
as I can tell they are unused today, so I'm opting not to pass them. We
may have to revisit this in the future.
keith added a commit to bazelbuild/rules_swift that referenced this pull request Oct 10, 2022
As of Swift 5.6 and this PR swiftlang/swift#39887
the new json format used for entirely explicit module builds can be used
without entirely disabling implicit modules. This provides an
alternative to VFS overlays for discovering dependencies without `-I`
search paths. This is theoretically about the same but I expect this
file format to have better support in general than VFS overlays for
things like the new incremental compilation support, which currently
doesn't support VFS overlays, and this shouldn't have any downsides vs
VFS files.

This format does support some more keys than just the 2 we pass, as far
as I can tell they are unused today, so I'm opting not to pass them. We
may have to revisit this in the future.

This kind of cherry picks 1666670 but I
kept the VFS feature for now for legacy users.
tymurmustafaiev pushed a commit to tymurmustafaiev/rules_swift that referenced this pull request Jul 19, 2023
As of Swift 5.6 and this PR swiftlang/swift#39887
the new json format used for entirely explicit module builds can be used
without entirely disabling implicit modules. This provides an
alternative to VFS overlays for discovering dependencies without `-I`
search paths. This is theoretically about the same but I expect this
file format to have better support in general than VFS overlays for
things like the new incremental compilation support, which currently
doesn't support VFS overlays, and this shouldn't have any downsides vs
VFS files.

This format does support some more keys than just the 2 we pass, as far
as I can tell they are unused today, so I'm opting not to pass them. We
may have to revisit this in the future.

This kind of cherry picks 1666670 but I
kept the VFS feature for now for legacy users.
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