-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Separate parsing out Swift and Clang modules from the explicit modulemap #63697
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
Separate parsing out Swift and Clang modules from the explicit modulemap #63697
Conversation
@allevato I only now noticed that this format collated Swift and Clang module details, when they share a name. I would like to separate them to have an entry per-module. This way the |
@swift-ci test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, why was the old behavior problematic? It seems like it should be fine if there's just one entry with a particular name in the list. Was some other tool like the dependency scanner writing the separate Swift/Clang entries instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just saw your other comment while I was reading over the PR. For my particular use case it's marginally less attractive to have the entries separated due to the way they'll be generated (we use a single data structure to represent Swift and Clang modules together, and the structure before this PR lets us write out all the fields at the same time). But, I can make this work, so I don't have a strong opinion here if it makes something else in your tooling easier.
Yeah. I ran into this when adopting the Clang module entries in the driver, which generates and specifies these module maps with a per-dependency entry, because the dependency scanner produces per-dependency entries. (Such entries ended up overwriting each other if they had the same name) I could teach it to detect and collate dependencies with the same name into one entry, but thought that this approach would be a bit more explicit. |
It sounds like our dependency managers do the exact opposite thing, then 🙂 In this case, me iterating over the dependencies twice (once to emit the Swift entries and once for the Clang entries) is probably easier than you having to collate things together before writing, so I'm ok with this. |
f9855e4
to
5a0bdab
Compare
@swift-ci test |
1 similar comment
@swift-ci test |
5a0bdab
to
aa34acd
Compare
@swift-ci test Windows platform |
… map Since swiftlang#63178 added support for Clang modules in the explicit module map, it is possible for there to be multiple modules with the same name: a Swift module and a Clang module. The current parsing logic just overwrites the corresponding entry module in a hashmap so we always only preserved the module that comes last, with the same name. This change separates the parsing of the modulemap JSON file to produce a separate Swift module map and Clang module map. The Swift one is used by the 'ExplicitSwiftModuleLoader', as before, and the Clang one is only used to populate the ClangArgs with the requried -fmodule-... flags.
aa34acd
to
a0b5dd4
Compare
@swift-ci test |
Since #63178 added support for Clang modules in the explicit module map, it used the convention of specifying artifacts of a Swift module with a given name and a Clang module with the same name under the same entry. This change separates an individual entry to represent an individual module, even if they have the same name (but one is Swift and one is Clang).
The current parsing logic just overwrites the corresponding entry module in a hashmap so we always only preserved the module that comes last, with the same name. This change separates the parsing of the modulemap JSON file to produce a separate Swift module map and Clang module map. The Swift one is used by the
ExplicitSwiftModuleLoader
, as before, and the Clang one is only used to populate the ClangArgs with the requried-fmodule-...
flags and discarded.