Skip to content

Commit 2263a34

Browse files
Enrich Jules.md with info from online Firebase C++ docs
This commit updates Jules.md, the AI agent guide, with additional context and details sourced from the official Firebase C++ online documentation. Key enhancements include: - **Introduction**: Added a link to the Firebase library support by platform table and a note on the open-source structure of the C++ SDKs (desktop vs. mobile). - **Setup Commands**: - Clarified iOS setup to include linking .framework files alongside pods. - Added a new "Desktop Platform Setup Details" subsection, covering: - Conversion of iOS `GoogleService-Info.plist` to `google-services-desktop.json` using the provided Python script. - Search order for desktop configuration files. - Common system library dependencies for Windows, macOS, and Linux desktop builds. - **API Surface**: - Clarified that `firebase::auth::User` objects are typically obtained from `firebase::auth::AuthResult` after successful authentication operations. - **Best Practices**: - Added a "Platform-Specific Considerations" subsection detailing: - The REST-based nature of the Realtime Database C++ SDK on desktop and the consequent need for server-side indexing for `OrderByChild()` queries. - Awareness of iOS method swizzling used by some Firebase products. These additions provide more comprehensive guidance for you, particularly regarding platform-specific nuances and SDK architecture. The document maintains an 80-character line wrap.
1 parent 07f4219 commit 2263a34

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

Jules.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ making changes to the Firebase C++ SDK repository. It covers essential
55
information about the repository's structure, setup, testing procedures, API
66
surface, best practices, and common coding patterns.
77

8+
For a detailed view of which Firebase products are supported on each C++
9+
platform (Android, iOS, tvOS, macOS, Windows, Linux), refer to the official
10+
[Firebase library support by platform table](https://firebase.google.com/docs/cpp/learn-more#library-support-by-platform).
11+
12+
The Firebase C++ SDKs for desktop platforms (Windows, Linux, macOS) are
13+
entirely open source and hosted in the main `firebase/firebase-cpp-sdk` GitHub
14+
repository. The C++ SDKs for mobile platforms (iOS, tvOS, Android) are built
15+
on top of the respective native open-source Firebase SDKs (Firebase iOS SDK and
16+
Firebase Android SDK).
17+
818
The goal is to enable agents to understand the existing conventions and
919
contribute effectively to the codebase.
1020

@@ -38,6 +48,9 @@ The SDK uses CMake for C++ compilation and Gradle for Android-specific parts.
3848
2. Run CMake to configure: `cmake ..`
3949
* For iOS:
4050
`cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/ios.cmake ..`
51+
Note: iOS setup typically requires both including Firebase pods (via
52+
`Podfile`) and linking the `.framework` files from the C++ SDK
53+
distribution.
4154
* For tvOS:
4255
`cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/apple.toolchain.cmake -DPLATFORM=TVOS ..`
4356
3. Build specific targets: `cmake --build . --target firebase_analytics`
@@ -59,6 +72,26 @@ This command should be run from the root of the repository. Proguard files are
5972
generated in each library's build directory (e.g.,
6073
`analytics/build/analytics.pro`).
6174

75+
### Desktop Platform Setup Details
76+
77+
When setting up for desktop, if you are using an iOS `GoogleService-Info.plist`
78+
file, convert it to the required `google-services-desktop.json` using the
79+
script: `python generate_xml_from_google_services_json.py --plist -i GoogleService-Info.plist`
80+
(run this from the script's directory, ensuring the plist file is accessible).
81+
82+
The desktop SDK searches for configuration files in the current working
83+
directory, first for `google-services-desktop.json`, then for
84+
`google-services.json`.
85+
86+
Common system library dependencies for desktop:
87+
* **Windows**: Common dependencies include `advapi32.lib`, `ws2_32.lib`,
88+
`crypt32.lib`. Specific products might need others (e.g., Firestore:
89+
`rpcrt4.lib`, `ole32.lib`, `shell32.lib`).
90+
* **macOS**: Common dependencies include `pthread` (system library) and
91+
frameworks like `CoreFoundation`, `Foundation`, and `Security`.
92+
* **Linux**: Common dependencies include `pthread` (system library). When
93+
using GCC 5+, define `-D_GLIBCXX_USE_CXX11_ABI=0`.
94+
6295
## Including the SDK in Projects
6396

6497
### CMake Projects
@@ -179,6 +212,12 @@ illustrate common API patterns:
179212
* **`firebase::auth::Auth`**: The main entry point for Firebase
180213
Authentication.
181214
* Used to manage users, sign in/out, etc.
215+
* Successful authentication operations (like
216+
`SignInWithEmailAndPassword()`) return a
217+
`Future<firebase::auth::AuthResult>`. The `firebase::auth::User`
218+
object can then be obtained from this `AuthResult` (e.g.,
219+
`auth_result.result()->user()` after `result()` is confirmed
220+
successful and the pointer is checked).
182221
* Example: `firebase::auth::User* current_user = auth->current_user();`
183222
* Methods for user creation/authentication:
184223
`CreateUserWithEmailAndPassword()`, `SignInWithEmailAndPassword()`,
@@ -319,6 +358,21 @@ API documentation.
319358
sections when necessary, but prefer separate implementation files where
320359
possible for better organization.
321360

361+
## Platform-Specific Considerations
362+
363+
* **Realtime Database (Desktop)**: The C++ SDK for Realtime Database on
364+
desktop platforms (Windows, macOS, Linux) uses a REST-based
365+
implementation. This means that any queries involving
366+
`Query::OrderByChild()` require corresponding indexes to be defined in your
367+
Firebase project's Realtime Database rules. Without these indexes, queries
368+
may fail or not return expected results.
369+
* **iOS Method Swizzling**: Be aware that some Firebase products on iOS
370+
(e.g., Dynamic Links, Cloud Messaging) use method swizzling to
371+
automatically attach handlers to your `AppDelegate`. While this simplifies
372+
integration, it can occasionally be a factor to consider when debugging app
373+
delegate behavior or integrating with other libraries that also perform
374+
swizzling.
375+
322376
## Class and File Structure
323377

324378
* Follow the existing pattern of internal and common classes within each

0 commit comments

Comments
 (0)