Skip to content

Commit e6a7a57

Browse files
committed
gemini re-write
1 parent 8c16a06 commit e6a7a57

File tree

1 file changed

+36
-82
lines changed

1 file changed

+36
-82
lines changed

firebase-firestore/README.md

Lines changed: 36 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -124,136 +124,90 @@ Run below to format Java code:
124124
See [here](../README.md#code-formatting) if you want to be able to format code from within Android
125125
Studio.
126126

127-
## Roll your own build of firebase-firestore for use in your application
127+
## Using a custom build in your application
128128

129-
It is possible, and, indeed, quite easy, to compile the `firebase-firestore` Gradle artifact from
130-
source and then use that self-compiled artifact in your Android application.
129+
To build `firebase-firestore` from source and use the resulting artifact in your
130+
Android application, follow these steps.
131131

132-
### Update gradle.properties with a custom version number
132+
### 1. Set a custom version
133133

134-
First, edit `firebase-firestore/gradle.properties` and change the "version" to something unique. It
135-
can be especially helpful to append a "-something" suffix to the version name, replacing "something"
136-
with some description of your change. Doing so will give you confidence that you are indeed using
137-
your self-compiled version in your application and not accidentally using an officially-published
138-
version.
139-
140-
For example, you can change the contents of `firebase-firestore/gradle.properties` from
134+
In `firebase-firestore/gradle.properties`, change the `version` to a unique
135+
value. Appending a suffix makes it easy to identify your custom build.
141136

137+
For example, change:
142138
```
143139
version=26.0.2
144140
latestReleasedVersion=26.0.1
145141
```
146142

147-
to
148-
143+
To:
149144
```
150145
version=99.99.99-MyFix1
151146
latestReleasedVersion=26.0.1
152147
```
153148

154-
### Build the `firebase-firestore` Gradle artifact
155-
156-
Then, build the `firebase-firestore` Gradle artifact by running:
149+
### 2. Build the artifact
157150

151+
Build and publish the artifact to your local Maven repository:
158152
```bash
159153
./gradlew :firebase-firestore:publishToMavenLocal
160154
```
161155

162-
### Add mavenLocal() repository to your Android app
163-
164-
In order to take a dependency on the self-compiled `firebase-firestore` Gradle artifact, first add
165-
`mavenLocal()` to the
166-
[`dependencyResolutionManagement.repositories`](https://docs.gradle.org/current/userguide/declaring_repositories.html)
167-
section of your Android application's `settings.gradle` or `settings.gradle.kts` file.
156+
### 3. Update your app's repositories
168157

169-
For example, you would change something like
158+
In your application's `settings.gradle` or `settings.gradle.kts` file, add
159+
`mavenLocal()` to the `repositories` block within
160+
`dependencyResolutionManagement`.
170161

171162
```kotlin
172163
dependencyResolutionManagement {
173164
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
174165
repositories {
175166
google()
176167
mavenCentral()
168+
mavenLocal() // Add this line
177169
}
178170
}
179171
```
180172

181-
to
182-
183-
```kotlin
184-
dependencyResolutionManagement {
185-
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
186-
repositories {
187-
google()
188-
mavenCentral()
189-
mavenLocal() // Add this line to use artifacts published by `publishToMavenLocal`
190-
}
191-
}
192-
```
173+
### 4. Update your app's dependencies
193174

194-
### Change the firebase-firestore dependency in your Android app
195-
196-
Then, edit your Android application's `build.gradle` or `build.gradle.kts` to use the self-compiled
197-
Gradle `firebase-firestore` artifact.
198-
199-
For example, you would change something like
175+
In your application's `build.gradle` or `build.gradle.kts` file, update the
176+
`firebase-firestore` dependency to use the custom version you set in step 1.
200177

201178
```kotlin
202179
dependencies {
203180
implementation(platform("com.google.firebase:firebase-bom:34.3.0"))
204-
implementation("com.google.firebase:firebase-firestore")
205-
// ... the rest of your application's dependencies
206-
}
207-
```
208-
209-
to
210-
211-
```kotlin
212-
dependencies {
213-
implementation(platform("com.google.firebase:firebase-bom:34.3.0"))
214-
// Use the custom version you set in gradle.properties in the next line.
181+
// Use the custom version from gradle.properties
215182
implementation("com.google.firebase:firebase-firestore:99.99.99-MyFix1")
216-
// ... the rest of your application's dependencies
183+
// ... other dependencies
217184
}
218185
```
219186

220-
### (Optional) Log the firebase-firestore version to logcat
221-
222-
It can be helpful to see in the logs which exact version of the `firebase-firestore` Gradle artifact
223-
your application is using. This increases the confidence that your application is indeed using the
224-
custom, self-compiled artifact rather than an official artifact.
187+
### Optional: Verify the version at runtime
225188

226-
To do this, simply add a line like the following somewhere in your Android application:
189+
To confirm that your application is using the custom artifact, you can log its
190+
version. Add the following code to your application:
227191

228192
```kotlin
229193
android.util.Log.i("FirestoreVersion", com.google.firebase.firestore.BuildConfig.VERSION_NAME)
230194
```
231195

232-
### (Rarely required) Self-compile dependencies of firebase-firestore
233-
234-
The `firebase-firestore` Gradle artifact includes dependencies on a few peer modules in the
235-
`firebase-android-sdk` repository. Although rare, sometimes you want, or need, to include local
236-
changes to these dependencies in your self-compiled build.
237-
238-
At the time of writing, the peer dependencies of `firebase-firestore` include:
239-
240-
- `firebase-common`
241-
- `firebase-components`
242-
- `firebase-database-collection`
243-
- `protolite-well-known-types`
196+
### Building with local module dependencies
244197

245-
For purposes of example, suppose there is a local change to `firebase-common` that you want your
246-
self-compiled `firebase-firestore` artifact to pick up. Follow the steps below to do this, adapting
247-
the steps as appropriate if your specific case uses a _different_ dependency.
198+
If your changes require building other modules in this repository (like
199+
`firebase-common`), you must build and publish them locally as well.
248200

249-
1. Edit `firebase-common/gradle.properties`, changing the verson to something like `99.99.99`.
250-
2. Compile and publish the `firebase-common` Gradle artifact by running:
251-
`./gradlew :firebase-common:publishToMavenLocal`
252-
3. If necessary, edit `firebase-firestore/firebase-firestore.gradle` to use a _project_ dependency
253-
on the artifact. For example, change `api(libs.firebase.common)` to
254-
`api(project(":firebase-common"))`
255-
4. Compile and publish the `firebase-firestore` Gradle artifact as documented above, namely, by
256-
running `./gradlew :firebase-firestore:publishToMavenLocal`
201+
1. In the dependency's directory (e.g., `firebase-common/`), edit
202+
`gradle.properties` to set a unique version.
203+
2. Publish the dependency to Maven Local:
204+
```bash
205+
./gradlew :firebase-common:publishToMavenLocal
206+
```
207+
3. In `firebase-firestore/firebase-firestore.gradle`, ensure the dependency is a
208+
project dependency. For example, change `api(libs.firebase.common)` to
209+
`api(project(":firebase-common"))`.
210+
4. Build and publish the `firebase-firestore` artifact as described in step 2.
257211

258212
## Misc
259213

0 commit comments

Comments
 (0)