@@ -124,16 +124,90 @@ Run below to format Java code:
124124See [ here] ( ../README.md#code-formatting ) if you want to be able to format code from within Android
125125Studio.
126126
127- ## Build Local Jar of Firestore SDK
127+ ## Using a custom build in your application
128128
129+ To build ` firebase-firestore ` from source and use the resulting artifact in your
130+ Android application, follow these steps.
131+
132+ ### 1. Set a custom version
133+
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.
136+
137+ For example, change:
138+ ```
139+ version=26.0.2
140+ latestReleasedVersion=26.0.1
141+ ```
142+
143+ To:
144+ ```
145+ version=99.99.99-MyFix1
146+ latestReleasedVersion=26.0.1
147+ ```
148+
149+ ### 2. Build the artifact
150+
151+ Build and publish the artifact to your local Maven repository:
129152``` bash
130- ./gradlew -PprojectsToPublish=" firebase-firestore" publishReleasingLibrariesToMavenLocal
153+ ./gradlew :firebase-firestore:publishToMavenLocal
154+ ```
155+
156+ ### 3. Update your app's repositories
157+
158+ In your application's ` settings.gradle ` or ` settings.gradle.kts ` file, add
159+ ` mavenLocal() ` to the ` repositories ` block within
160+ ` dependencyResolutionManagement ` .
161+
162+ ``` kotlin
163+ dependencyResolutionManagement {
164+ repositoriesMode.set(RepositoriesMode .FAIL_ON_PROJECT_REPOS )
165+ repositories {
166+ google()
167+ mavenCentral()
168+ mavenLocal() // Add this line
169+ }
170+ }
171+ ```
172+
173+ ### 4. Update your app's dependencies
174+
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.
177+
178+ ``` kotlin
179+ dependencies {
180+ implementation(platform(" com.google.firebase:firebase-bom:34.3.0" ))
181+ // Use the custom version from gradle.properties
182+ implementation(" com.google.firebase:firebase-firestore:99.99.99-MyFix1" )
183+ // ... other dependencies
184+ }
185+ ```
186+
187+ ### Optional: Verify the version at runtime
188+
189+ To confirm that your application is using the custom artifact, you can log its
190+ version. Add the following code to your application:
191+
192+ ``` kotlin
193+ android.util.Log .i(" FirestoreVersion" , com.google.firebase.firestore.BuildConfig .VERSION_NAME )
131194```
132195
133- Developers may then take a dependency on these locally published versions by adding the
134- ` mavenLocal() ` repository to your
135- [ repositories block] ( https://docs.gradle.org/current/userguide/declaring_repositories.html ) in your
136- app module's build.gradle.
196+ ### Building with local module dependencies
197+
198+ If your changes require building other modules in this repository (like
199+ ` firebase-common ` ), you must build and publish them locally as well.
200+
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.
137211
138212# # Misc
139213
0 commit comments