Skip to content

Commit 1087fb6

Browse files
Added the Firebase Android BoM to manage all Firebase library versions.
1 parent 8d15e3c commit 1087fb6

File tree

6 files changed

+33
-20
lines changed

6 files changed

+33
-20
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.idea/
22
.gradle/
3+
.kotlin/
34
build/
45
*.iml
56
/local.properties

README.md

+11-10
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ You can add the library via Gradle:
2525

2626
```kotlin
2727
dependencies {
28-
implementation("dev.gitlive:firebase-java-sdk:0.4.5")
28+
implementation("dev.gitlive:firebase-java-sdk:0.4.6")
2929
}
3030
```
3131

@@ -35,7 +35,7 @@ Or Maven:
3535
<dependency>
3636
<groupId>dev.gitlive</groupId>
3737
<artifactId>firebase-java-sdk</artifactId>
38-
<version>0.4.5</version>
38+
<version>0.4.6</version>
3939
</dependency>
4040
```
4141

@@ -104,14 +104,15 @@ val app = Firebase.initialize(new Application(), options)
104104

105105
The following libraries are available for the various Firebase products.
106106

107-
| Service or Product | Port of Android version |
108-
|-----------------------------------------------------------------------------------|:------------------------|
109-
| [Authentication](https://firebase.google.com/docs/auth) | N/A[^1] |
110-
| [Cloud Firestore](https://firebase.google.com/docs/firestore) | `24.10.0` |
111-
| [Realtime Database](https://firebase.google.com/docs/database) | `20.3.0` |
112-
| [Cloud Functions](https://firebase.google.com/docs/functions) | `20.4.0` |
113-
| ~[Remote Config](https://firebase.google.com/docs/remote-config)~ | `21.6.0`[^2] |
114-
| ~[Installations](https://firebase.google.com/docs/projects/manage-installations)~ | `17.2.0`[^2] |
107+
| Service or Product | Port of Android version |
108+
|---------------------------------------------------------------------------------------------------|:------------------------|
109+
| [Firebase Android BoM](https://maven.google.com/web/index.html?#com.google.firebase:firebase-bom) | `32.7.0` |
110+
| [Authentication](https://firebase.google.com/docs/auth) | N/A[^1] |
111+
| [Cloud Firestore](https://firebase.google.com/docs/firestore) | `24.10.0` |
112+
| [Realtime Database](https://firebase.google.com/docs/database) | `20.3.0` |
113+
| [Cloud Functions](https://firebase.google.com/docs/functions) | `20.4.0` |
114+
| ~[Remote Config](https://firebase.google.com/docs/remote-config)~ | `21.6.0`[^2] |
115+
| ~[Installations](https://firebase.google.com/docs/projects/manage-installations)~ | `17.2.0`[^2] |
115116

116117
[^1]: Google has not open-sourced the Firebase Auth implementation for Android so a basic implementation using the Rest API is provided.
117118
[^2]: Although the libraries are inlcuded they are currently not funtional

build.gradle.kts

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import java.util.Locale
12

23
buildscript {
34
repositories {
@@ -86,7 +87,7 @@ val jar by tasks.getting(Jar::class) {
8687
val sourceSets = project.the<SourceSetContainer>()
8788

8889
val cleanLibs by tasks.creating(Delete::class) {
89-
delete("$buildDir/libs")
90+
delete("$${layout.buildDirectory.asFile.get().path}/libs")
9091
}
9192

9293
publishing {
@@ -146,9 +147,11 @@ publishing {
146147
dependencies {
147148
compileOnly(libs.robolectric.android.all)
148149
testImplementation(libs.junit)
149-
testImplementation(libs.kotlinx.coroutines.swing)
150150
testImplementation(libs.kotlinx.coroutines.play.services)
151+
testImplementation(libs.kotlinx.coroutines.swing)
152+
testImplementation(libs.kotlinx.coroutines.test)
151153
// firebase aars
154+
aar(platform(libs.google.firebase.bom))
152155
aar(libs.google.firebase.firestore)
153156
aar(libs.google.firebase.functions)
154157
aar(libs.google.firebase.database)
@@ -195,7 +198,8 @@ signing {
195198
tasks.withType<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask> {
196199

197200
fun isNonStable(version: String): Boolean {
198-
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
201+
val stableKeyword = listOf("RELEASE", "FINAL", "GA")
202+
.any { version.uppercase(Locale.ROOT).contains(it) }
199203
val versionMatch = "^[0-9,.v-]+(-r)?$".toRegex().matches(version)
200204

201205
return (stableKeyword || versionMatch).not()

gradle/libs.versions.toml

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[versions]
22
androidx-lifecycle = "2.9.0-alpha01"
33
ben-manes-versions = "0.51.0"
4+
google-firebase-bom = "32.7.0"
45
io-grpc = "1.66.0"
56
jlleitschuh-ktlint = "12.1.1"
67
kotlin = "2.0.20"
@@ -12,11 +13,12 @@ ktlint = "0.47.1"
1213
androidx-collection = { module = "androidx.collection:collection", version = "1.4.3" }
1314
androidx-lifecycle-common = { module = "androidx.lifecycle:lifecycle-common", version.ref = "androidx-lifecycle" }
1415
androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel", version.ref = "androidx-lifecycle" }
15-
google-firebase-config = { module = "com.google.firebase:firebase-config", version = "21.6.0" }
16-
google-firebase-database = { module = "com.google.firebase:firebase-database", version = "20.3.0" }
17-
google-firebase-firestore = { module = "com.google.firebase:firebase-firestore", version = "24.10.0" }
18-
google-firebase-functions = { module = "com.google.firebase:firebase-functions", version = "20.4.0" }
19-
google-firebase-installations = { module = "com.google.firebase:firebase-installations", version = "17.2.0" }
16+
google-firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "google-firebase-bom" }
17+
google-firebase-config = { module = "com.google.firebase:firebase-config" }
18+
google-firebase-database = { module = "com.google.firebase:firebase-database" }
19+
google-firebase-firestore = { module = "com.google.firebase:firebase-firestore" }
20+
google-firebase-functions = { module = "com.google.firebase:firebase-functions" }
21+
google-firebase-installations = { module = "com.google.firebase:firebase-installations" }
2022
io-grpc-okhttp = { module = "io.grpc:grpc-okhttp", version.ref = "io-grpc" }
2123
io-grpc-protobuf-lite = { module = "io.grpc:grpc-protobuf-lite", version.ref = "io-grpc" }
2224
io-grpc-stub = { module = "io.grpc:grpc-stub", version.ref = "io-grpc" }
@@ -25,6 +27,7 @@ junit = { module = "junit:junit", version = "4.13.2" }
2527
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
2628
kotlinx-coroutines-play-services = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services", version.ref = "kotlinx-coroutines" }
2729
kotlinx-coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" }
30+
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }
2831
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" }
2932
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
3033
okhttp = { module = "com.squareup.okhttp3:okhttp", version = "3.12.13" }

src/main/java/android/os/Looper.java

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
public class Looper {
66
private static final Looper main = new Looper();
77

8+
public Thread getThread() {
9+
return Thread.currentThread();
10+
}
11+
812
public static Looper getMainLooper() {
913
return main;
1014
}

src/test/kotlin/FirestoreTest.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import com.google.firebase.FirebaseOptions
44
import com.google.firebase.FirebasePlatform
55
import com.google.firebase.firestore.firestore
66
import com.google.firebase.initialize
7-
import kotlinx.coroutines.runBlocking
87
import kotlinx.coroutines.tasks.await
8+
import kotlinx.coroutines.test.runTest
99
import org.junit.Assert.assertEquals
1010
import org.junit.Before
1111
import org.junit.Test
@@ -34,7 +34,7 @@ class FirestoreTest : FirebaseTest() {
3434
}
3535

3636
@Test
37-
fun testFirestore(): Unit = runBlocking {
37+
fun testFirestore(): Unit = runTest {
3838
val data = Data("jim")
3939
val doc = Firebase.firestore.document("sally/jim")
4040
doc.set(data)

0 commit comments

Comments
 (0)