Skip to content

build(firestore): remove FirebaseCore from the CMake build - #17153

Draft
paulb777 wants to merge 3 commits into
mainfrom
pb-firestore-cmake-no-core
Draft

paulb777 wants to merge 3 commits into
mainfrom
pb-firestore-cmake-no-core

Conversation

@paulb777

@paulb777 paulb777 commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Removes FirebaseCore from the CMake build. Firestore's CMake build no longer compiles or links FirebaseCore on Apple platforms, and uses the same portable implementations there as on Linux. This is CMake and CI only; the SDKs that ship (CocoaPods, SPM, zip) don't change.

Needs sign-off from the Firestore and firebase-cpp-sdk owners.

Why

FirebaseCore is going to be reimplemented in Swift (design option D4-C). CMake can't reasonably build that Swift code, and keeping a frozen Objective-C copy for CMake would mean testing a FirebaseCore that never ships. The CMake build is best at the portable C++ core and its sanitizers. The Apple-specific code that needs FirebaseCore is already built and tested against the real FirebaseCore in the Xcode jobs. Doing this now, while FirebaseCore is still Objective-C, shows the change is safe before the port starts.

What changes

On Apple platforms, the CMake build now uses the implementations that Linux already uses:

  • log_stdio.cc instead of log_apple.mm. This only mattered for CMake iOS builds: macOS CMake builds already used log_stdio.cc.
  • empty_credentials_provider.h instead of the Auth and App Check credentials providers for Apple platforms. Firestore's core never creates these; only the Objective-C layer and their tests do.
  • firebase_metadata_provider_noop.cc instead of firebase_metadata_provider_apple.mm. The no-op provider was already compiled on every platform.

The CMake build no longer compiles:

  • firebase_auth_credentials_provider_apple.mm, firebase_app_check_credentials_provider_apple.mm, firebase_metadata_provider_apple.mm and the two provider tests (firebase_*_credentials_provider_test.mm);
  • testutil/app_testing.mm, which creates FIRApp instances;
  • the Objective-C layer (Firestore/Source) and its tests and benchmarks (Firestore/Example), which only built with FIRESTORE_INCLUDE_OBJC.

Build files:

  • Deleted: FirebaseCore/CMakeLists.txt, the CMake files of the Objective-C layer and Firestore/Example, and the GoogleUtilities CMake files (cmake/GoogleUtilities.cmake, cmake/external/GoogleUtilities.cmake), which only FirebaseCore used, so there's one download fewer. Also the CMake files of the Auth and App Check interop headers, which only the removed code used.
  • firestore_util, firestore_core and firestore_testutil no longer link FirebaseCore (or the interop targets).
  • Nothing in the CMake build refers to FirebaseCore or GoogleUtilities any more (git grep of CMakeLists.txt and *.cmake, and of the generated build.ninja).

FIRESTORE_INCLUDE_OBJC. It's no longer an option, because the Objective-C layer can't build without FirebaseCore. Builds that set it to OFF, such as firebase-cpp-sdk's, keep working without an "unused variable" warning, because the CMake file still reads it. Setting it to ON is a configure error that points to the Xcode and SPM builds, so a build that relied on the Objective-C layer finds out at configure time instead of silently losing it. If the CMake build ever needs the Apple code paths again, a later change could bring them back behind a FirebaseCore target provided by the including project.

CI. No workflow changes are needed. The cmake, sanitizers-mac, sanitizers-ubuntu and cmake-linux-boringssl jobs pass no FirebaseCore- or Objective-C-related flags. scripts/build.sh no longer starts the Firestore emulator for the CMake build: only the Objective-C integration tests used it, and no C++ test does.

Docs. CMAKE.md now has a "What the CMake build covers" section that lists what moved to the Xcode and SPM builds and explains FIRESTORE_INCLUDE_OBJC.

Coverage that moves out of CMake

The removed CMake tests still run against the real FirebaseCore in the Xcode jobs (xcodetest_emulator, xcodetest_prod and xcodetest_nightly in sdk.firestore.yml, on iOS, macOS and tvOS). Their Firestore_IntegrationTests_<platform> targets include all of Firestore/Example/Tests/** (API, spec and integration tests) and Firestore/core/test/** (including the two provider tests and app_testing).

What's lost is sanitizer coverage. sanitizers-mac ran ASan and TSan over the CMake build, including:

  • the Objective-C layer, through firestore_objc_api_test, firestore_objc_spec_test and firestore_objc_integration_test;
  • the Apple credentials and metadata providers and their tests.

The Xcode jobs don't use sanitizers. The portable C++ core keeps its ASan/TSan coverage on macOS and its ASan coverage on Ubuntu.

Follow-up (not in this PR): add ASan and TSan to an Xcode or SPM run of the Firestore tests on macOS, for example Firestore_IntegrationTests_macOS against the emulator, or a new SPM test target for Firestore_Tests. That replaces the lost sanitizers-mac coverage of the Apple-specific code.

firebase-cpp-sdk

firebase-cpp-sdk's desktop build (macOS included) adds the root of this repository with add_subdirectory and FIRESTORE_INCLUDE_OBJC=OFF.

  • Today: that compiles the Objective-C FirebaseCore and the three Apple provider files on every macOS desktop build, but firebase-cpp-sdk doesn't use any of it. It brings its own credentials and metadata providers (credentials_provider_desktop_SRCS, firebase_metadata_provider_desktop_SRCS) and its own firebase::App. macOS CMake builds already log through log_stdio.cc.
  • After this change: that dead code is gone from its macOS build, and it needs no new flags.
  • iOS: its iOS build doesn't use this CMake build. It gets Firestore and FirebaseCore from SPM.
  • Timing: it pins a firebase-ios-sdk release (set(version 13.2.0) in cmake/external/firestore.cmake), so it picks this up when it next bumps.
  • CI check: its desktop.yml macOS job can verify a branch with FIRESTORE_DEP_SOURCE=<branch> once this is pushed.

Unrelated to this change: its firestore.patch.txt no longer applies cleanly to main. One hunk is already applied, and the hunk for mutation_test.cc fails. It will need refreshing at the next bump anyway.

Testing

Local, on macOS (Apple silicon) with CMake 3.31.2 (CI's version, installed locally from PyPI) and Ninja 1.13.2. The flags were those of scripts/build.sh (-G Ninja -Wdeprecated -DCMAKE_BUILD_TYPE=Debug -DOPENSSL_ROOT_DIR=<openssl@3>), with Xcode 26.5.

  • Before (this PR's base, 4cfedc0): configure and ninja -k 10 all succeeded with 2134 build steps. ctest lists 16 tests. 15 passed. I didn't run firestore_objc_integration_test, which needs the Firestore emulator.
    • The 13 gtest binaries had 3120 tests between them, including 23 in firestore_credentials_test.
    • The XCTest bundles: firestore_objc_api_test ran 55 tests and firestore_objc_spec_test 5 (the spec runner).
  • After: configure from scratch and ninja -k 10 all succeeded with 2009 build steps. ctest lists 13 tests, and all 13 passed.
    • The gtest counts are unchanged except firestore_credentials_test: 23 → 10, since the 13 Apple provider tests are gone.
    • Removed: firestore_objc_api_test, firestore_objc_spec_test and firestore_objc_integration_test. The Xcode jobs cover them, as above.
    • Compiled Apple .mm files: the three provider files are gone. The remaining 8 don't need FirebaseCore: byte_stream, connectivity_monitor, error, exception, filesystem, grpc_tls_credentials_provider, status and a hashing test.
    • The build log has 26 warnings, against 29 before. All of them are dependency deprecations and duplicate-library linker notes, the same kinds as before.
  • Configure-only:
    • -DFIRESTORE_INCLUDE_OBJC=OFF -DFIREBASE_IOS_BUILD_TESTS=OFF (firebase-cpp-sdk's flags) configures.
    • -DFIRESTORE_INCLUDE_OBJC=ON fails at configure time with its error message.
    • After the review change that removed the option() declarations, reconfigured from scratch with CMake 3.31.2: the default and -DFIRESTORE_INCLUDE_OBJC=OFF -DFIREBASE_IOS_BUILD_TESTS=OFF configure with no "not used by the project" warning, and -DFIRESTORE_INCLUDE_OBJC=ON fails with its message.
  • firebase-cpp-sdk @ 0c31588, desktop macOS, Firestore only:
    • I configured it against its pinned 13.2.0 release. Its build.ninja has 14 FirebaseCore/Sources objects.
    • Then I replaced the downloaded firebase-ios-sdk with this branch, plus its firestore.patch.txt minus the two hunks that no longer apply, and reconfigured: 0 FirebaseCore objects.
    • With FIREBASE_INCLUDE_FIRESTORE and FIREBASE_INCLUDE_AUTH on, ninja firebase_firestore firebase_auth builds firestore_core and libfirebase_firestore.a against this branch. libfirebase_firestore.a has no undefined FIR* or Apple-provider symbols. The archives were built, but not linked into an app: test apps were off.
    • I couldn't use FIRESTORE_DEP_SOURCE, because it clones from GitHub and this branch isn't pushed.
  • For CI, cmake and sanitizers-* cover the rest. Locally I used -DCMAKE_POLICY_VERSION_MINIMUM=3.5 only for a first attempt with CMake 4.4.5, whose policy errors in c-ares and the root project are unrelated to this change. The results above are all from CMake 3.31.2.
  • check_whitespace.sh and check_copyright.sh report nothing.

#no-changelog

This PR was prepared with AI assistance.

The CMake build compiled the Objective-C FirebaseCore on Apple platforms,
and firestore_util and firestore_core linked it even when the Objective-C
layer was off. FirebaseCore is going to be reimplemented in Swift, which
CMake doesn't build, and CMake's job is the portable C++ core.

On Apple platforms, Firestore's CMake build now uses the implementations
that Linux uses: log_stdio, the empty credentials providers and the no-op
Firebase metadata provider. It no longer compiles the code that needs
FirebaseCore:
- the Auth and App Check credentials providers and the Firebase metadata
  provider for Apple platforms, and the provider tests;
- testutil/app_testing.mm;
- the Objective-C layer (Firestore/Source) and its tests and benchmarks
  (Firestore/Example), which only built with FIRESTORE_INCLUDE_OBJC.
The Xcode and Swift Package Manager builds still build and test all of it
against the real FirebaseCore.

FIRESTORE_INCLUDE_OBJC now defaults to OFF, and a new
FIRESTORE_USE_FIREBASE_CORE option defaults to OFF. Both stay so that
builds that set them to OFF, like firebase-cpp-sdk's, keep working, and
setting either to ON is a configure error that points to the Xcode and
SPM builds.

Also delete FirebaseCore/CMakeLists.txt, the GoogleUtilities CMake files
that only FirebaseCore used (one fewer download), and the CMake files of
the Auth and App Check interop headers, which only the removed code used.
scripts/build.sh no longer starts the Firestore emulator for the CMake
build: only the Objective-C integration tests used it. CMAKE.md describes
what the CMake build covers.
@gemini-code-assist

Copy link
Copy Markdown
Contributor
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@paulb777

Copy link
Copy Markdown
Member Author

/gemini review

@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 refactors the CMake build system to focus solely on Firestore's portable C++ core and its tests, removing the compilation of FirebaseCore, FirebaseAuth/Interop, FirebaseAppCheck/Interop, and the Firestore Objective-C layer and examples. On Apple platforms, the CMake build now utilizes portable implementations (such as stdio logging and empty credentials providers) rather than FirebaseCore-dependent ones. Feedback suggests simplifying the CMake configuration by removing the unsupported option() declarations for FIRESTORE_USE_FIREBASE_CORE and FIRESTORE_INCLUDE_OBJC while keeping the error checks, which keeps the CMake cache clean while maintaining backward compatibility.

Comment thread Firestore/CMakeLists.txt Resolved
FIRESTORE_USE_FIREBASE_CORE was new in this change and could only be OFF, so
remove it. FIRESTORE_INCLUDE_OBJC is no longer declared as an option either.
The CMake file still reads it, so builds that set it to OFF keep working
without an unused-variable warning, and ON is still an error.
@paulb777

Copy link
Copy Markdown
Member Author

/gemini review

@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 refactors the CMake build configuration for Firestore to focus solely on the portable C++ core and its tests, removing the build of FirebaseCore, Objective-C layers, and Apple-specific credentials providers from CMake. This includes deleting several CMake configuration files for FirebaseCore, FirebaseAppCheck, FirebaseAuth, and GoogleUtilities, as well as updating scripts/build.sh to no longer start the Firestore emulator for CMake builds. Feedback suggests checking if FIRESTORE_INCLUDE_OBJC is defined before evaluating its truthiness in Firestore/CMakeLists.txt to prevent potential uninitialized variable warnings under strict CMake options.

Comment thread Firestore/CMakeLists.txt Resolved

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant