Skip to content
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

Umbrella objc_library in experimental_mixed_language_library produces malformed .swift.modulemap #1184

Closed
aaronsky opened this issue Mar 27, 2024 · 3 comments · Fixed by #1191

Comments

@aaronsky
Copy link

Not entirely sure if this is rules_swift or rules_apple, but here we go.

I am trying to sort out workarounds to bazel#7944, in particular for propagating module maps from transitive dependencies of objc_librarys into their copts. While investigating this issue, I noticed that in the experimental_mixed_language_library macro from rules_apple, the objc_library that consumes an extended module map gets an additional module map created for it (I think by something in rules_swift). From a clean build of a module named PrintStream, the following module maps are created:

  • PrintStream.internal.objc.modulemap
  • PrintStream.internal.umbrella.modulemap
  • PrintStream.internal.umbrella.swift.modulemap

This .swift.modulemap contains all manner of headers from a given CcCompilationContext, including things that are not headers but are provided as headers due to the absence of a cc_inputs-like parameter on objc_library, such as Clang configuration files, header maps, or other module maps, and as such Clang fails to parse them. Despite this, these module maps are still propagated as -fmodule-map-file to other library targets.

My suspicion is that, unless feature loading is totally broken in swift_library (i.e. something is failing to receive the swift.no_generated_module_map setting) the issue lies somewhere in how swift_clang_module_aspect is loading objc_library module info. But beyond that, I am uncertain how to move forward. @luispadron and I made a little progress investigating, but we could use more eyes.

@aaronsky
Copy link
Author

aaronsky commented Apr 2, 2024

I can work around this with the changes in #691, which allow me to suppress aspect behavior for my custom module maps.

@luispadron
Copy link
Contributor

@aaronsky Is that something you think should be added to the experimental_mixed_language_library module maps?

@aaronsky
Copy link
Author

aaronsky commented Apr 5, 2024

Yes, there are a few related improvements that I need to push up to experimental_mixed_language_library. Without them, I have to continue using my highly-derivative home-cooked macro.

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 a pull request may close this issue.

2 participants