Skip to content

Commit

Permalink
Added the Firebase Android BoM to manage all Firebase library versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
siarhei-luskanau committed Sep 4, 2024
1 parent 8d15e3c commit 1087fb6
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.idea/
.gradle/
.kotlin/
build/
*.iml
/local.properties
Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You can add the library via Gradle:

```kotlin
dependencies {
implementation("dev.gitlive:firebase-java-sdk:0.4.5")
implementation("dev.gitlive:firebase-java-sdk:0.4.6")
}
```

Expand All @@ -35,7 +35,7 @@ Or Maven:
<dependency>
<groupId>dev.gitlive</groupId>
<artifactId>firebase-java-sdk</artifactId>
<version>0.4.5</version>
<version>0.4.6</version>
</dependency>
```

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

The following libraries are available for the various Firebase products.

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

[^1]: Google has not open-sourced the Firebase Auth implementation for Android so a basic implementation using the Rest API is provided.
[^2]: Although the libraries are inlcuded they are currently not funtional
Expand Down
10 changes: 7 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import java.util.Locale

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

val cleanLibs by tasks.creating(Delete::class) {
delete("$buildDir/libs")
delete("$${layout.buildDirectory.asFile.get().path}/libs")
}

publishing {
Expand Down Expand Up @@ -146,9 +147,11 @@ publishing {
dependencies {
compileOnly(libs.robolectric.android.all)
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.swing)
testImplementation(libs.kotlinx.coroutines.play.services)
testImplementation(libs.kotlinx.coroutines.swing)
testImplementation(libs.kotlinx.coroutines.test)
// firebase aars
aar(platform(libs.google.firebase.bom))
aar(libs.google.firebase.firestore)
aar(libs.google.firebase.functions)
aar(libs.google.firebase.database)
Expand Down Expand Up @@ -195,7 +198,8 @@ signing {
tasks.withType<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask> {

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

return (stableKeyword || versionMatch).not()
Expand Down
13 changes: 8 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[versions]
androidx-lifecycle = "2.9.0-alpha01"
ben-manes-versions = "0.51.0"
google-firebase-bom = "32.7.0"
io-grpc = "1.66.0"
jlleitschuh-ktlint = "12.1.1"
kotlin = "2.0.20"
Expand All @@ -12,11 +13,12 @@ ktlint = "0.47.1"
androidx-collection = { module = "androidx.collection:collection", version = "1.4.3" }
androidx-lifecycle-common = { module = "androidx.lifecycle:lifecycle-common", version.ref = "androidx-lifecycle" }
androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel", version.ref = "androidx-lifecycle" }
google-firebase-config = { module = "com.google.firebase:firebase-config", version = "21.6.0" }
google-firebase-database = { module = "com.google.firebase:firebase-database", version = "20.3.0" }
google-firebase-firestore = { module = "com.google.firebase:firebase-firestore", version = "24.10.0" }
google-firebase-functions = { module = "com.google.firebase:firebase-functions", version = "20.4.0" }
google-firebase-installations = { module = "com.google.firebase:firebase-installations", version = "17.2.0" }
google-firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "google-firebase-bom" }
google-firebase-config = { module = "com.google.firebase:firebase-config" }
google-firebase-database = { module = "com.google.firebase:firebase-database" }
google-firebase-firestore = { module = "com.google.firebase:firebase-firestore" }
google-firebase-functions = { module = "com.google.firebase:firebase-functions" }
google-firebase-installations = { module = "com.google.firebase:firebase-installations" }
io-grpc-okhttp = { module = "io.grpc:grpc-okhttp", version.ref = "io-grpc" }
io-grpc-protobuf-lite = { module = "io.grpc:grpc-protobuf-lite", version.ref = "io-grpc" }
io-grpc-stub = { module = "io.grpc:grpc-stub", version.ref = "io-grpc" }
Expand All @@ -25,6 +27,7 @@ junit = { module = "junit:junit", version = "4.13.2" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-play-services = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version = "3.12.13" }
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/android/os/Looper.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
public class Looper {
private static final Looper main = new Looper();

public Thread getThread() {
return Thread.currentThread();
}

public static Looper getMainLooper() {
return main;
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/kotlin/FirestoreTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import com.google.firebase.FirebaseOptions
import com.google.firebase.FirebasePlatform
import com.google.firebase.firestore.firestore
import com.google.firebase.initialize
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.tasks.await
import kotlinx.coroutines.test.runTest
import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
Expand Down Expand Up @@ -34,7 +34,7 @@ class FirestoreTest : FirebaseTest() {
}

@Test
fun testFirestore(): Unit = runBlocking {
fun testFirestore(): Unit = runTest {
val data = Data("jim")
val doc = Firebase.firestore.document("sally/jim")
doc.set(data)
Expand Down

0 comments on commit 1087fb6

Please sign in to comment.