mirror of
https://github.com/firebase/firebase-ios-sdk.git
synced 2026-10-02 07:04:46 +08:00
Add support for Swift Package Traits (SE-0450) in Package.swift by introducing a default-enabled "Firestore" trait. Previously, depending on the firebase-ios-sdk Swift package resolved and downloaded Cloud Firestore and its heavy underlying dependencies (gRPC, Abseil, and prebuilt binary artifacts), even if an application only used lightweight Firebase products (such as Auth, Crashlytics, or Remote Config). With package traits, developers can now opt out of Cloud Firestore in their Package.swift (via `traits: []`) or through Xcode 26.4+'s Package Dependencies UI, pruning heavy dependencies and speeding up package resolution while preserving full backwards compatibility: - Define the "Firestore" trait in Package.swift, enabled by default in `packageTraits`. - Gate source and binary Firestore target dependencies (abseil, gRPC, FirebaseFirestoreInternalWrapper, FirebaseFirestoreCombineSwift) on `.when(traits: ["Firestore"])`. - Add `FIRESTORE_TRAIT_ENABLED` C preprocessor macro via target cSettings on `FirebaseFirestoreTarget` and `objc-import-test` to enable conditional compilation for Clang targets when the trait is active. - Provide a clear compile-time `#error` diagnostic in `dummy.m` if an app target links Firestore without enabling the trait. - Gate conditional imports in integration test targets (`swift-test` and `objc-import-test`) so test suites pass both with default traits and with `--disable-default-traits`. - Opt out of default traits in `FirebaseAITestApp` (in project.pbxproj), validating Xcode trait opt-out and avoiding Firestore dependencies for AI Logic integration tests. - Add release notes and Xcode opt-out instructions to changelogs in `FirebaseCore/CHANGELOG.md` and `Firestore/CHANGELOG.md`.