Objective-C Generated Interface Header doesn't respect custom modulemap's umbrella header
| Originator: | p4checo | ||
| Number: | rdar://24641873 | Date Originated: | 13/02/2016 |
| Status: | Open | Resolved: | |
| Product: | Xcode | Product Version: | Xcode 7.2.1, 7.3b2 |
| Classification: | Important | Reproducible: | Always |
Summary: When defining a custom modulemap in a Framework with a non-standard umbrella header, the Objective-C Generated Interface Header (ModuleName-Swift.h) doesn't contain the correct #import if the Swift classes in the module extend any of the ObjC classes in the same module. In the provided sample project, there are 2 App targets and 2 Framework targets, with the same exact source files. The first is a standard setup, where the modulemap is generated automatically and the umbrella header is "Module.h". In this scenario everything works as expected. The second is a custom setup, where the modulemap is explicitly defined with a custom umbrella header "ModuleName-umbrella.h". In this scenario, the generated "ModuleName-Swift.h" will have an #include pointing to an non-existent (default/hardcoded) header (#import <ModuleName/ModuleName.h>), when it should be pointing to the umbrella header defined in the given modulemap (#import <ModuleName/ModuleName-umbrella.h>). Steps to Reproduce: 1. Open provided project. 2. Build and Run "StandardFrameworkApp" target, the app should build and run. 3. Build and Run "CustomFrameworkApp" target, the app will fail to build. Expected Results: When building "CustomFrameworkApp" target, the app should build and run. More specifically, the generated Objective-C Generated Interface Header should honor the umbrella header defined in the custom modulemap's when #import'ing the framework's own code. Actual Results: The generated Objective-C Generated Interface Header doesn't honor the umbrella header defined in the custom modulemap's, and assumes the default value "ModuleName.h" when generating the #import for the framework's own code. In the provided project, when the "CustomFrameworkApp" fails to build, if you change the line: "#import <CustomMixedFramework/CustomMixedFramework.h>" to: "#import <CustomMixedFramework/CustomMixedFramework-umbrella.h>" then the target will correctly build and run, proving that the fix is quite simple Version: Xcode 7.2.1 and Xcode 7.3b2 Notes: There's also an issue in the indexer, which doesn't correctly detect the framework's module name when importing using "@import ModuleName;". However, the app builds and runs fine. Configuration: Any Mac with Xcode installed Attachments: 'ObjCGeneratedInterfaceHeaderTests.zip' was successfully uploaded.
Comments
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!
This issue is still present on XCode 8.1. The quick fix for now is to add #import ‹ ModuleName/ModuleName-umbrella.h › inside a ModuleName.h ...