Skip to content

Change iOS builds to use Swift Packages instead of Cocoapods - #1928

Open
a-maurice wants to merge 3 commits into
mainfrom
am-spm_work_take3
Open

a-maurice wants to merge 3 commits into
mainfrom
am-spm_work_take3

Conversation

@a-maurice

Copy link
Copy Markdown
Contributor

Description

Provide details of the change, and generalize the change in the PR title above.

Since Cocoapods is being turned down, migrate the iOS builds to Swift Packages instead. This includes both the SDK build logic, converting ios_pod to ios_spm and getting the necessary dependencies, and the scripts we have to update the version numbers.

This should not affect end users of the built SDKs, only the build process.


Testing

Describe how you've tested these changes. Link any manually triggered Integration tests or CPP binary SDK Packaging Github Action workflows, if applicable.

Running scripts locally.


Type of Change

Place an x the applicable box:

  • Bug fix. Add the issue # below if applicable.
  • New feature. A non-breaking change which adds functionality.
  • Other, such as a build process or documentation change.

Notes

  • Bug fixes and feature changes require an update to the Release Notes section of release_build_files/readme.md.
  • Read the contribution guidelines CONTRIBUTING.md.
  • Changes to the public API require an internal API review. If you'd like to help us make Firebase APIs better, please propose your change in a feature request so that we can discuss it together.

@a-maurice a-maurice added the skip-release-notes Skip release notes check label Sep 30, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request migrates the iOS and tvOS dependency management from CocoaPods to Swift Package Manager (SPM). It removes the old ios_pod configuration, Podfile, and CocoaPods setup scripts, replacing them with an ios_spm directory containing Package.swift and a new CMake integration (setup_spm_headers and symlink_spm_headers). All Firebase modules, helper scripts, and documentation have been updated to support this transition. Feedback on the changes highlights a critical NameError in scripts/update_android_ios_dependencies.py due to an un-renamed variable, a potential failure in file(CREATE_LINK) in ios_spm/CMakeLists.txt if symlinks already exist, and a redundant include path in firestore/CMakeLists.txt that should be removed.

Comment on lines 782 to 783
modify_project_file_spm(project_file, latest_pod_versions_map, args.dryrun,
args.ignore_ios_versions)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

The variable latest_pod_versions_map is not defined in this scope because it was renamed to latest_ios_versions_map on line 771. This will cause a NameError at runtime when running the dependency update script. Please update this reference to use latest_ios_versions_map.

Suggested change
modify_project_file_spm(project_file, latest_pod_versions_map, args.dryrun,
args.ignore_ios_versions)
modify_project_file_spm(project_file, latest_ios_versions_map, args.dryrun,
args.ignore_ios_versions)

Comment thread ios_spm/CMakeLists.txt
Comment on lines +185 to +187
if(fw_headers MATCHES "${preferred_slice}" OR NOT EXISTS "${symlink_base_dir}/${fw_name}")
file(MAKE_DIRECTORY "${symlink_base_dir}")
file(CREATE_LINK "${fw_headers}" "${symlink_base_dir}/${fw_name}" SYMBOLIC COPY_ON_ERROR)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

If a symlink already exists at ${symlink_base_dir}/${fw_name} (for example, from a previous CMake run or a different architecture slice), file(CREATE_LINK) will fail because it does not automatically overwrite existing links. To make this robust, we should remove the existing symlink before creating a new one.

          if(fw_headers MATCHES "${preferred_slice}" OR NOT EXISTS "${symlink_base_dir}/${fw_name}")
            file(MAKE_DIRECTORY "${symlink_base_dir}")
            if(EXISTS "${symlink_base_dir}/${fw_name}")
              file(REMOVE "${symlink_base_dir}/${fw_name}")
            endif()
            file(CREATE_LINK "${fw_headers}" "${symlink_base_dir}/${fw_name}" SYMBOLIC COPY_ON_ERROR)

Comment thread firestore/CMakeLists.txt
Comment on lines +347 to 350
${FIREBASE_SPM_CHECKOUTS_DIR}/firebase-ios-sdk
${FIREBASE_SPM_CHECKOUTS_DIR}/firebase-ios-sdk/Firestore
${FIREBASE_SPM_CHECKOUTS_DIR}/firebase-ios-sdk/FirebaseFirestoreInternal
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

FirebaseFirestoreInternal is a target name in the Swift Package, but it is not an actual directory in the firebase-ios-sdk repository checkout (the Firestore source is entirely under Firestore/). Therefore, this include path is non-existent and redundant. It should be removed.

      ${FIREBASE_SPM_CHECKOUTS_DIR}/firebase-ios-sdk
      ${FIREBASE_SPM_CHECKOUTS_DIR}/firebase-ios-sdk/Firestore
  )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-release-notes Skip release notes check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant