Repository navigation
Conversation
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.
Using Gemini Code AssistThe 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
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 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. |
|
/gemini review |
There was a problem hiding this comment.
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.
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.
|
/gemini review |
There was a problem hiding this comment.
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.
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.ccinstead oflog_apple.mm. This only mattered for CMake iOS builds: macOS CMake builds already usedlog_stdio.cc.empty_credentials_provider.hinstead 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.ccinstead offirebase_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.mmand the two provider tests (firebase_*_credentials_provider_test.mm);testutil/app_testing.mm, which createsFIRAppinstances;Firestore/Source) and its tests and benchmarks (Firestore/Example), which only built withFIRESTORE_INCLUDE_OBJC.Build files:
FirebaseCore/CMakeLists.txt, the CMake files of the Objective-C layer andFirestore/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_coreandfirestore_testutilno longer linkFirebaseCore(or the interop targets).git grepofCMakeLists.txtand*.cmake, and of the generatedbuild.ninja).FIRESTORE_INCLUDE_OBJC. It's no longer an option, because the Objective-C layer can't build without FirebaseCore. Builds that set it toOFF, such as firebase-cpp-sdk's, keep working without an "unused variable" warning, because the CMake file still reads it. Setting it toONis 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-ubuntuandcmake-linux-boringssljobs pass no FirebaseCore- or Objective-C-related flags.scripts/build.shno longer starts the Firestore emulator for the CMake build: only the Objective-C integration tests used it, and no C++ test does.Docs.
CMAKE.mdnow has a "What the CMake build covers" section that lists what moved to the Xcode and SPM builds and explainsFIRESTORE_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_prodandxcodetest_nightlyinsdk.firestore.yml, on iOS, macOS and tvOS). TheirFirestore_IntegrationTests_<platform>targets include all ofFirestore/Example/Tests/**(API, spec and integration tests) andFirestore/core/test/**(including the two provider tests andapp_testing).What's lost is sanitizer coverage.
sanitizers-macran ASan and TSan over the CMake build, including:firestore_objc_api_test,firestore_objc_spec_testandfirestore_objc_integration_test;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_macOSagainst the emulator, or a new SPM test target forFirestore_Tests. That replaces the lostsanitizers-maccoverage of the Apple-specific code.firebase-cpp-sdk
firebase-cpp-sdk's desktop build (macOS included) adds the root of this repository with
add_subdirectoryandFIRESTORE_INCLUDE_OBJC=OFF.credentials_provider_desktop_SRCS,firebase_metadata_provider_desktop_SRCS) and its ownfirebase::App. macOS CMake builds already log throughlog_stdio.cc.set(version 13.2.0)incmake/external/firestore.cmake), so it picks this up when it next bumps.desktop.ymlmacOS job can verify a branch withFIRESTORE_DEP_SOURCE=<branch>once this is pushed.Unrelated to this change: its
firestore.patch.txtno longer applies cleanly tomain. One hunk is already applied, and the hunk formutation_test.ccfails. 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.ninja -k 10 allsucceeded with 2134 build steps. ctest lists 16 tests. 15 passed. I didn't runfirestore_objc_integration_test, which needs the Firestore emulator.firestore_credentials_test.firestore_objc_api_testran 55 tests andfirestore_objc_spec_test5 (the spec runner).ninja -k 10 allsucceeded with 2009 build steps. ctest lists 13 tests, and all 13 passed.firestore_credentials_test: 23 → 10, since the 13 Apple provider tests are gone.firestore_objc_api_test,firestore_objc_spec_testandfirestore_objc_integration_test. The Xcode jobs cover them, as above..mmfiles: 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.-DFIRESTORE_INCLUDE_OBJC=OFF -DFIREBASE_IOS_BUILD_TESTS=OFF(firebase-cpp-sdk's flags) configures.-DFIRESTORE_INCLUDE_OBJC=ONfails at configure time with its error message.option()declarations, reconfigured from scratch with CMake 3.31.2: the default and-DFIRESTORE_INCLUDE_OBJC=OFF -DFIREBASE_IOS_BUILD_TESTS=OFFconfigure with no "not used by the project" warning, and-DFIRESTORE_INCLUDE_OBJC=ONfails with its message.build.ninjahas 14FirebaseCore/Sourcesobjects.firestore.patch.txtminus the two hunks that no longer apply, and reconfigured: 0 FirebaseCore objects.FIREBASE_INCLUDE_FIRESTOREandFIREBASE_INCLUDE_AUTHon,ninja firebase_firestore firebase_authbuildsfirestore_coreandlibfirebase_firestore.aagainst this branch.libfirebase_firestore.ahas no undefinedFIR*or Apple-provider symbols. The archives were built, but not linked into an app: test apps were off.FIRESTORE_DEP_SOURCE, because it clones from GitHub and this branch isn't pushed.cmakeandsanitizers-*cover the rest. Locally I used-DCMAKE_POLICY_VERSION_MINIMUM=3.5only 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.shandcheck_copyright.shreport nothing.#no-changelog
This PR was prepared with AI assistance.