Skip to content

Conversation

keith
Copy link
Member

@keith keith commented 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.

This kind of cherry picks 1666670 but I kept the VFS feature for now for legacy users.

@lyft-lint-bot
Copy link

Lyft integration job started: https://buildkite.com/lyft/rules-swift/builds/236 (must be Lyft employee to view)

@@ -202,6 +202,11 @@ SWIFT_FEATURE_USE_RESPONSE_FILES = "swift.use_response_files"
# when access to those paths involves traversing a networked file system.
SWIFT_FEATURE_VFSOVERLAY = "swift.vfsoverlay"

# If enabled, Swift compilation actions will use a explicit module map file for
# discovering dependencies. This is faster than using search paths when you
# have many dependencies. This doesn't apply to system dependencies.
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't need to go in the comment, but what is the tipping point for "many"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hard to say, for us at this point with >2k modules (not all in every dependency tree) this improves build performance by >50%, so if you have more than maybe 20 it's worth a try?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there any downside to just using this always when on Swift 5.6+?

Copy link
Member Author

Choose a reason for hiding this comment

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

not that I know of yet, I don't recall why we never defaulted the VFS overlay to on 🤔 , but I also haven't tested incremental with this

@lyft-lint-bot
Copy link

Lyft integration job started: https://buildkite.com/lyft/rules-swift/builds/237 (must be Lyft employee to view)

@lyft-lint-bot
Copy link

Lyft integration job started: https://buildkite.com/lyft/rules-swift/builds/238 (must be Lyft employee to view)

@keith keith force-pushed the ks/add-feature-for-partially-explicit-modules branch from 66746bb to a930545 Compare April 25, 2022 21:05
@lyft-lint-bot
Copy link

Lyft integration job started: https://buildkite.com/lyft/rules-swift/builds/348 (must be Lyft employee to view)

@brentleyjones
Copy link
Collaborator

1666670

@keith keith force-pushed the ks/add-feature-for-partially-explicit-modules branch from a930545 to 27a1259 Compare October 10, 2022 21:52
@keith
Copy link
Member Author

keith commented Oct 10, 2022

ok I pushed a new version here where I manually pulled changes from the upstream commit, but also left the VFS feature around for existing users. we can probably remove it as upstream did once we're confident this works without downsides and we don't care about older swift versions

keith referenced this pull request Oct 10, 2022
…e explicit Swift module JSON file supported by Swift 5.6 (but not enabled on any toolchain yet).

This file is actually supported in earlier versions of Swift, but 5.6 is the first version where it doesn't require *all* modules (i.e., system modules) to be specified explicitly as well.

PiperOrigin-RevId: 456822150
@keith keith force-pushed the ks/add-feature-for-partially-explicit-modules branch from 27a1259 to 73231cf Compare October 10, 2022 22:44
@keith keith marked this pull request as ready for review October 10, 2022 22:58
@keith keith merged commit fd39daf into master Oct 10, 2022
@keith keith deleted the ks/add-feature-for-partially-explicit-modules branch October 10, 2022 22:58
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