Backport of #11472 to the releases/4.201.x line.
This is a regression introduced in 4.201.0-rc.1 (via #11290), so the fix needs to ship in the current 4.201.0 RC rather than only on the next minor. Cherry-picked cleanly from main (cherry picked from commit 58cea1eb167...).
Summary
Targets depending on a precompiled xcframework that ships a module.modulemap fail to compile with Redefinition of module 'X'.
Xcode’s ProcessXCFramework already extracts the SDK-matching slice’s headers — including any module.modulemap — into $(BUILT_PRODUCTS_DIR)/include, which is on the header search path. Since #11290, GraphTraverser.librariesPublicHeadersFolders additionally adds every xcframework slice’s Headers to HEADER_SEARCH_PATHS, putting a second copy of the same module on the search path → redefinition of module 'X'.
The fix skips those headers when the xcframework ships a module map; module-map-less xcframeworks (the cached Swift/library products from #11290) keep their headers, so that feature is unaffected.
See #11472 for the full root-cause analysis and end-to-end verification (reproduced on 4.201.0-canary.13, unit tests, and a clean rebuild with the patched CLI).
🤖 Generated with Claude Code