Hive Hive
Sign in

fix(cli): support package documentation module imports

GitHub issue · Closed

Metadata
Source
tuist/tuist #11135
Updated
Jun 24, 2026
Domains
Generated projects
Details

Resolves https://github.com/tuist/tuist/issues/6637

DocC builds for generated projects could fail on Swift package targets whose public Objective-C headers import another module from the same package. The Firebase fixture exposed two related gaps:

  • FirebaseCoreExtension publicly imports FirebaseCore, but Firebase does not declare that as a target dependency in Package.swift. Firebase documents the requirement in a comment instead: https://github.com/firebase/firebase-ios-sdk/blob/1fc52ab0e172e7c5a961f975a76c2611f4f22852/Package.swift#L213-L225
  • Tuist removes MODULEMAP_FILE from generated framework targets to avoid baking non-portable absolute module map paths into products. That remains correct, but DocC’s C ExtractAPI invocation needs dependency framework module maps to be available at the canonical Modules/module.modulemap location.

Source pointers

I checked SwiftPM and swift-build before keeping this shape. The implementation now includes comments pointing at the relevant upstream files.

So this PR mirrors the upstream module-map behavior for Tuist’s generated Xcode project path, and adds a narrowly scoped Firebase compatibility layer for the manifest gap. The added target dependency is derived only from concrete #import or #include references in public headers, only when the imported module matches a regular target in the same package, only when the dependency is not already declared, and only when adding it would not create a cycle. It does not use product names, effective module names, or @import statements.

The module-map change is also gated to framework targets that already had MODULEMAP_FILE. It preserves the existing sanitization behavior and only adds a dependency-analysis-aware post-build script to copy the known module map to $(TARGET_BUILD_DIR)/$(WRAPPER_NAME)/Modules/module.modulemap.

Validation

  • xcodebuild test -workspace Tuist.xcworkspace -scheme Tuist-Workspace -only-testing TuistGeneratorTests/ModuleMapMapperTests CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY="" COMPILATION_CACHE_ENABLE_CACHING=NO
  • xcodebuild test -workspace Tuist.xcworkspace -scheme Tuist-Workspace -only-testing TuistLoaderTests/PackageInfoMapperTests CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY="" COMPILATION_CACHE_ENABLE_CACHING=NO -derivedDataPath /tmp/tuist-loader-test-dd
  • xcodebuild build -workspace Tuist.xcworkspace -scheme tuist CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY="" COMPILATION_CACHE_ENABLE_CACHING=NO
  • From examples/xcode/generated_multiplatform_app_with_sdk: /Users/pepicrft/Library/Developer/Xcode/DerivedData/Tuist-avdqkhoscuahapbomflgnybwgdsa/Build/Products/Debug/tuist generate --no-open
  • From examples/xcode/generated_multiplatform_app_with_sdk: xcodebuild docbuild -workspace App.xcworkspace -scheme App -destination 'generic/platform=iOS Simulator' CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY=""
  • After the naming cleanup in this update: xcodebuild test -workspace Tuist.xcworkspace -scheme Tuist-Workspace -only-testing TuistLoaderTests/PackageInfoMapperTests CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY="" COMPILATION_CACHE_ENABLE_CACHING=NO

I also tested two reduced variants:

  • Module-map copy only: still failed with the original FirebaseCore/FIRApp.h missing error because FirebaseCoreExtension had no generated build dependency on FirebaseCore.
  • Public-header-derived dependency only: generated the missing build edge, but DocC still failed because ExtractAPI could not discover the dependency framework module map without the canonical Modules/module.modulemap copy.
Comments
T
tuist[bot] Jun 7, 2026

🛠️ Tuist Run Report 🛠️

Tests 🧪
Scheme Status Cache hit rate Tests Skipped Ran Commit
TuistAcceptanceTests 0 % 193 0 193 f6a0b1611
TuistUnitTests 0 % 3722 29 3693 f6a0b1611
Failed Tests ❌
Flaky Tests ⚠️
  • TuistAcceptanceTests: 1 flaky test (View all)
Test case Module Suite
app_with_plugins() TuistKitAcceptanceTests PluginAcceptanceTests
Builds 🔨
Scheme Status Duration Commit
TuistAcceptanceTests 4m 48s f6a0b1611
TuistUnitTests 5m 3s f6a0b1611