Xcode does not pass all -fmodule-map-file flags to SourceKit

Originator:davg
Number:rdar://36107040 Date Originated:Dec 18 2017
Status:Closed Resolved:July 5 2018
Product:Developer Tools Product Version:9.1
Classification:Bug Reproducible:Always
 
Summary: When Xcode makes a 'source.request.editor.open.interface' request to SourceKit, Xcode will only include the last -fmodule-map-file argument even if the file's build settings has multiple -fmodule-map-file present. Note that Xcode does pass all -fmodule-map-files when making a 'source.request.cursorinfo' request to SourceKit.

This is reproducible even with Swift Package Manager, which seems to use a workaround for this apparent issue: https://github.com/apple/swift-package-manager/blob/6bac701d2b730434681205273897be91cbd67212/Sources/Xcodeproj/pbxproj().swift#L595 (this bug report is a possible duplicate of radar/30071677). Their workaround is hacky (has side effects if other things are included in the directory containing the module map) and may also lead into https://llvm.org/bugs/show_bug.cgi?id=19501. When not using this workaround, one is not able to view any of the modules included via -fmodule-map-file besides the one for the last -fmodule-map-file argument given. 

Expected Results:
Xcode passes all -fmodule-map-file arguments to SourceKit

Actual Results:
Xcode passes only the last -fmodule-map-file argument to SourceKit

Version/Build:
Xcode 9.1, but also reproduced on Xcode 9.2, Xcode 9.1, and Xcode 8.3.3 (didn't try reproducing further back)

Comments

Fixed in Xcode 10 beta 3.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!