Skip to content

CBL-8722: Generate the Swift private module maps from templates - #3557

Merged
pasin merged 3 commits into
masterfrom
CBL-8722
Aug 13, 2026
Merged

CBL-8722: Generate the Swift private module maps from templates#3557
pasin merged 3 commits into
masterfrom
CBL-8722

Conversation

@pasin

@pasin pasin commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Problem

  • The CouchbaseLiteSwift_Private module maps are hand-maintained per edition in two repos, so the editions can drift apart if we forget to update both, and the CE repo's CI cannot verify the EE copy.

Solution

  • Generate both editions' module maps in the CE repo from header list templates, following the Objective-C/Exports pattern.

Changes

  • Add Swift/ModuleMap/ header list templates and generate_private_modulemap.sh; the EE module map is the CE header list plus the EE additions.
  • Point CBL_Swift / CBL_EE_Swift xcconfigs at the generated module maps; the EE repo no longer hosts a module map.
  • Verify the generated files are up to date in an github action.
  • Enable MemberImportVisibility so a Swift file using a type it does not import itself fails to build (catches missing private module imports).
  • Strip the private module map from the framework in Release builds only as they are required by the XCode Indexer.

Companion PR : https://github.com/couchbaselabs/couchbase-lite-ios-ee/pull/349

…plates

Problem:
- The CouchbaseLiteSwift_Private module maps are hand-maintained per
edition in two repos, so the editions can drift apart if we forget to
update both, and the CE repo's CI cannot verify the EE copy.

Solution:
- Generate both editions' module maps in the CE repo from header list
  templates, following the Objective-C/Exports pattern.

Changes:
- Add Swift/ModuleMap/ header list templates and
generate_private_modulemap.sh; the EE module map is the CE header list
plus the EE additions.
- Point CBL_Swift / CBL_EE_Swift xcconfigs at the generated module maps;
the EE repo no longer hosts a module map.
- Verify the generated files are up to date in
pull_request_build_test.sh.
- Enable MemberImportVisibility so a Swift file using a type it does not
import itself fails to build (catches missing private module imports).
- Strip the private module map from the framework in Release builds
only.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces drift between Community Edition (CE) and Enterprise Edition (EE) Swift private module maps by generating both from header-list templates in the CE repo, and wiring builds/CI to use and validate the generated outputs.

Changes:

  • Add Swift/ModuleMap header-list templates plus a generator script, and commit generated CE/EE private module maps.
  • Update Swift (CE/EE) build settings to reference the generated module maps and enable MemberImportVisibility diagnostics.
  • Update CI and packaging scripts and refresh repo guidance/docs for the new workflow.

Reviewed changes

Copilot reviewed 10 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
xcconfigs/Project.xcconfig Enables SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY to catch missing imports.
xcconfigs/CBL_Swift.xcconfig Points CE Swift target at generated private module map.
xcconfigs/CBL_EE_Swift.xcconfig Points EE Swift target at generated EE private module map (no longer in EE repo).
Swift/ModuleMap/generate_private_modulemap.sh Adds generator/check script to produce CE+EE module maps from templates.
Swift/ModuleMap/CouchbaseLiteSwift.private.txt Adds CE header list template consumed by the generator.
Swift/ModuleMap/CouchbaseLiteSwift-EE.private.txt Adds EE-only header list template consumed by the generator.
Swift/ModuleMap/Generated/CouchbaseLiteSwift.private.modulemap Marks CE module map as generated and updates header.
Swift/ModuleMap/Generated/CouchbaseLiteSwift-EE.private.modulemap Adds generated EE private module map output.
Swift/ModuleMap/Generated/CouchbaseLiteSwift-EE.private.txt Adds an extra EE header list under Generated/ (currently duplicates the template).
Scripts/pull_request_build_test.sh Adds a CI check to ensure generated module maps are up to date.
Scripts/remove_private_module.sh Strips private module only for Release* builds to preserve Xcode indexing for dev builds.
CouchbaseLite.xcodeproj/project.pbxproj Adds ModuleMap groups/files to the Xcode project.
AGENTS.md Updates contributor guidance for the new module map generation workflow.
Suppressed comments (1)

CouchbaseLite.xcodeproj/project.pbxproj:3458

  • The new ModuleMap/Generated group contains the CE generated module map but also includes CouchbaseLiteSwift-EE.private.txt (a header-list template), while the generated EE module map file isn’t listed. This layout makes it easy to edit the wrong file and defeats the “generated output vs template” separation.
			isa = PBXGroup;
			children = (
				40F52B1D3026ED0F009C5F9E /* CouchbaseLiteSwift.private.modulemap */,
				40CC4B78302BE6EF0002386D /* CouchbaseLiteSwift-EE.private.txt */,
			);

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Scripts/pull_request_build_test.sh Outdated
Comment thread AGENTS.md Outdated
Comment thread xcconfigs/Project.xcconfig Outdated
Comment thread Swift/ModuleMap/Generated/CouchbaseLiteSwift-EE.private.txt Outdated
Comment thread CouchbaseLite.xcodeproj/project.pbxproj Outdated

This comment was marked as resolved.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 12 changed files in this pull request and generated no new comments.

- Add check_modulemaps.yml workflow running generate_private_modulemap.sh --check on PRs
- Remove the check from pull_request_build_test.sh
@pasin
pasin requested a review from jianminzhao August 12, 2026 03:40
@pasin
pasin merged commit ffa5546 into master Aug 13, 2026
9 checks passed
@pasin
pasin deleted the CBL-8722 branch August 13, 2026 03:59
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 this pull request may close these issues.

3 participants