Skip to content

Commit 87d408f

Browse files
committed
Merge remote-tracking branch 'GitLiveApp/master' into gitlive/kotlin-1.8.21-gradle-8
2 parents 361c007 + daae020 commit 87d408f

File tree

109 files changed

+2870
-1184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+2870
-1184
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ jobs:
4242
run: ./gradlew :firebase-firestore:publish
4343
- name: Publish Firebase Functions
4444
run: ./gradlew :firebase-functions:publish
45+
- name: Publish Firebase Storage
46+
run: ./gradlew :firebase-storage:publish
4547
- name: Publish Firebase Installations
4648
run: ./gradlew :firebase-installations:publish
4749
- name: Publish Firebase Performance

README.md

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
<h1 align="left">Firebase Kotlin SDK <img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/gitliveapp/firebase-kotlin-sdk?style=flat-square"> <a href="https://git.live"><img src="https://img.shields.io/badge/collaborate-on%20gitlive-blueviolet?style=flat-square"></a></h1>
22
<img align="left" width="75px" src="https://avatars2.githubusercontent.com/u/42865805?s=200&v=4">
33
<b>Built and maintained with 🧡 by <a href="https://git.live">GitLive</a></b><br/>
4-
<i>Real-time code collaboration inside any IDE</i><br/>
4+
<i>Development teams merge faster with GitLive</i><br/>
55
<br/>
66
<br/>
7-
The Firebase Kotlin SDK is a Kotlin-first SDK for Firebase. It's API is similar to the <a href="https://firebase.github.io/firebase-android-sdk/reference/kotlin/firebase-ktx/">Firebase Android SDK Kotlin Extensions</a> but also supports multiplatform projects, enabling you to use Firebase directly from your common source targeting <strong>iOS</strong>, <strong>Android</strong> or <strong>JS</strong>.
7+
The Firebase Kotlin SDK is a Kotlin-first SDK for Firebase. It's API is similar to the
8+
<a href="https://firebase.github.io/firebase-android-sdk/reference/kotlin/firebase-ktx/">Firebase Android SDK Kotlin Extensions</a>
9+
but also supports multiplatform projects, enabling you to use Firebase directly from your common source targeting
10+
<strong>iOS</strong>, <strong>Android</strong>, <strong>Desktop</strong> or <strong>Web</strong>, enabling the use of
11+
Firebase as a backend for <a href="https://www.jetbrains.com/lp/compose-multiplatform/">Compose Multiplatform</a>, for example.
812

913
## Available libraries
1014

1115
The following libraries are available for the various Firebase products.
1216

13-
| Service or Product | Gradle Dependency | API Coverage |
14-
|---------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
15-
| [Authentication](https://firebase.google.com/docs/auth) | [`dev.gitlive:firebase-auth:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-auth/1.8.0/pom) | [![80%](https://img.shields.io/badge/-80%25-green?style=flat-square)](/firebase-auth/src/commonMain/kotlin/dev/gitlive/firebase/auth/auth.kt) |
16-
| [Realtime Database](https://firebase.google.com/docs/database) | [`dev.gitlive:firebase-database:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-database/1.8.0/pom) | [![70%](https://img.shields.io/badge/-70%25-orange?style=flat-square)](/firebase-database/src/commonMain/kotlin/dev/gitlive/firebase/database/database.kt) |
17-
| [Cloud Firestore](https://firebase.google.com/docs/firestore) | [`dev.gitlive:firebase-firestore:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-firestore/1.8.0/pom) | [![60%](https://img.shields.io/badge/-60%25-orange?style=flat-square)](/firebase-firestore/src/commonMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt) |
18-
| [Cloud Functions](https://firebase.google.com/docs/functions) | [`dev.gitlive:firebase-functions:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-functions/1.8.0/pom) | [![80%](https://img.shields.io/badge/-80%25-green?style=flat-square)](/firebase-functions/src/commonMain/kotlin/dev/gitlive/firebase/functions/functions.kt) |
19-
| [Cloud Messaging](https://firebase.google.com/docs/cloud-messaging) | [`dev.gitlive:firebase-messaging:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-messaging/1.8.0/pom) | ![0%](https://img.shields.io/badge/-0%25-lightgrey?style=flat-square) |
20-
| [Cloud Storage](https://firebase.google.com/docs/storage) | [`dev.gitlive:firebase-storage:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-storage/1.8.0/pom) | ![0%](https://img.shields.io/badge/-0%25-lightgrey?style=flat-square) |
21-
| [Installations](https://firebase.google.com/docs/projects/manage-installations) | [`dev.gitlive:firebase-installations:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-installations/1.8.0/pom) | [![90%](https://img.shields.io/badge/-90%25-green?style=flat-square)](/firebase-installations/src/commonMain/kotlin/dev/gitlive/firebase/installations/installations.kt) |
22-
| [Remote Config](https://firebase.google.com/docs/remote-config) | [`dev.gitlive:firebase-config:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-config/1.8.0/pom) | ![20%](https://img.shields.io/badge/-20%25-orange?style=flat-square) |
23-
| [Performance](https://firebase.google.com/docs/perf-mon) | [`dev.gitlive:firebase-perf:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-perf/1.8.0/pom) | ![1%](https://img.shields.io/badge/-1%25-orange?style=flat-square) |
24-
| [Crashlytics](https://firebase.google.com/docs/crashlytics) | [`dev.gitlive:firebase-crashlytics:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-crashlytics/1.8.0/pom) | ![80%](https://img.shields.io/badge/-1%25-orange?style=flat-square) |
25-
26-
27-
17+
| Service or Product | Gradle Dependency | API Coverage |
18+
|---------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
19+
| [Authentication](https://firebase.google.com/docs/auth) | [`dev.gitlive:firebase-auth:1.10.0`](https://search.maven.org/artifact/dev.gitlive/firebase-auth/1.10.0/pom) | [![80%](https://img.shields.io/badge/-80%25-green?style=flat-square)](/firebase-auth/src/commonMain/kotlin/dev/gitlive/firebase/auth/auth.kt) |
20+
| [Realtime Database](https://firebase.google.com/docs/database) | [`dev.gitlive:firebase-database:1.10.0`](https://search.maven.org/artifact/dev.gitlive/firebase-database/1.10.0/pom) | [![70%](https://img.shields.io/badge/-70%25-orange?style=flat-square)](/firebase-database/src/commonMain/kotlin/dev/gitlive/firebase/database/database.kt) |
21+
| [Cloud Firestore](https://firebase.google.com/docs/firestore) | [`dev.gitlive:firebase-firestore:1.10.0`](https://search.maven.org/artifact/dev.gitlive/firebase-firestore/1.10.0/pom) | [![60%](https://img.shields.io/badge/-60%25-orange?style=flat-square)](/firebase-firestore/src/commonMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt) |
22+
| [Cloud Functions](https://firebase.google.com/docs/functions) | [`dev.gitlive:firebase-functions:1.10.0`](https://search.maven.org/artifact/dev.gitlive/firebase-functions/1.10.0/pom) | [![80%](https://img.shields.io/badge/-80%25-green?style=flat-square)](/firebase-functions/src/commonMain/kotlin/dev/gitlive/firebase/functions/functions.kt) |
23+
| [Cloud Messaging](https://firebase.google.com/docs/cloud-messaging) | [`dev.gitlive:firebase-messaging:1.10.0`](https://search.maven.org/artifact/dev.gitlive/firebase-messaging/1.10.0/pom) | ![0%](https://img.shields.io/badge/-0%25-lightgrey?style=flat-square) |
24+
| [Cloud Storage](https://firebase.google.com/docs/storage) | [`dev.gitlive:firebase-storage:1.10.0`](https://search.maven.org/artifact/dev.gitlive/firebase-storage/1.10.0/pom) | [![40%](https://img.shields.io/badge/-40%25-orange?style=flat-square)](/firebase-storage/src/commonMain/kotlin/dev/gitlive/firebase/storage/storage.kt) |
25+
| [Installations](https://firebase.google.com/docs/projects/manage-installations) | [`dev.gitlive:firebase-installations:1.10.0`](https://search.maven.org/artifact/dev.gitlive/firebase-installations/1.10.0/pom) | [![90%](https://img.shields.io/badge/-90%25-green?style=flat-square)](/firebase-installations/src/commonMain/kotlin/dev/gitlive/firebase/installations/installations.kt) |
26+
| [Remote Config](https://firebase.google.com/docs/remote-config) | [`dev.gitlive:firebase-config:1.10.0`](https://search.maven.org/artifact/dev.gitlive/firebase-config/1.10.0/pom) | [![20%](https://img.shields.io/badge/-20%25-orange?style=flat-square)](/firebase-config/src/commonMain/kotlin/dev/gitlive/firebase/remoteconfig/FirebaseRemoteConfig.kt) |
27+
| [Performance](https://firebase.google.com/docs/perf-mon) | [`dev.gitlive:firebase-perf:1.10.0`](https://search.maven.org/artifact/dev.gitlive/firebase-perf/1.10.0/pom) | [![1%](https://img.shields.io/badge/-1%25-orange?style=flat-square)](/firebase-perf/src/commonMain/kotlin/dev/gitlive/firebase/perf/performance.kt) |
28+
| [Crashlytics](https://firebase.google.com/docs/crashlytics) | [`dev.gitlive:firebase-crashlytics:1.10.0`](https://search.maven.org/artifact/dev.gitlive/firebase-crashlytics/1.10.0/pom) | [![80%](https://img.shields.io/badge/-1%25-orange?style=flat-square)](/firebase-crashlytics/src/commonMain/kotlin/dev/gitlive/firebase/crashlytics/crashlytics.kt) |
2829

2930
Is the Firebase library or API you need missing? [Create an issue](https://github.com/GitLiveApp/firebase-kotlin-sdk/issues/new?labels=API+coverage&template=increase-api-coverage.md&title=Add+%5Bclass+name%5D.%5Bfunction+name%5D+to+%5Blibrary+name%5D+for+%5Bplatform+names%5D) to request additional API coverage or be awesome and [submit a PR](https://github.com/GitLiveApp/firebase-kotlin-sdk/fork)
3031

@@ -205,6 +206,8 @@ In cases where it makes sense, such as Firebase Functions HTTPS Callable, operat
205206

206207
The Firebase Kotlin SDK provides a common API to access Firebase for projects targeting *iOS*, *Android* and *JS* meaning you can use Firebase directly in your common code. Under the hood, the SDK achieves this by binding to the respective official Firebase SDK for each supported platform.
207208

209+
It uses the <a href="https://github.com/GitLiveApp/firebase-java-sdk">Firebase Java SDK</a> to support the JVM target.
210+
208211
### Accessing the underlying Firebase SDK
209212

210213
In some cases you might want to access the underlying official Firebase SDK in platform specific code, for example when the common API is missing the functionality you need. For this purpose each class in the SDK has `android`, `ios` and `js` properties which holds the equivalent object of the underlying official Firebase SDK.
@@ -217,23 +220,10 @@ These properties are only accessible from the equivalent target's source set. Fo
217220
.build()
218221
```
219222

220-
### NPM modules
221-
222-
If you are building a Kotlin multiplatform library which will be consumed from JS code you may need to include the SDK in your `package.json`, you can do it as follows:
223-
224-
```json
225-
"dependencies": {
226-
"@gitlive/firebase-auth": "1.8.0",
227-
"@gitlive/firebase-config": "1.8.0",
228-
"@gitlive/firebase-database": "1.8.0",
229-
"@gitlive/firebase-firestore": "1.8.0",
230-
"@gitlive/firebase-functions": "1.8.0",
231-
"@gitlive/firebase-installations": "1.8.0",
232-
"@gitlive/firebase-messaging": "1.8.0",
233-
"@gitlive/firebase-storage": "1.8.0"
234-
"@gitlive/firebase-perf": "1.8.0"
235-
"@gitlive/firebase-crashlytics": "1.8.0"
236-
}
237-
```
238-
239-
223+
## Contributing
224+
If you'd like to contribute to this project then you can fork this repository.
225+
You can build and test the project locally.
226+
1. Open the project in IntelliJ IDEA.
227+
2. Install cocoapods via `sudo gem install -n /usr/local/bin cocoapods`
228+
3. Install the GitLive plugin into IntelliJ
229+
4. After a gradle sync then run `publishToMavenLocal`

build.gradle.kts

Lines changed: 13 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import org.apache.tools.ant.taskdefs.condition.Os
21
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
32
import org.gradle.api.tasks.testing.logging.TestLogEvent
43

@@ -44,7 +43,8 @@ tasks {
4443
"firebase-firestore:updateVersion", "firebase-firestore:updateDependencyVersion",
4544
"firebase-functions:updateVersion", "firebase-functions:updateDependencyVersion",
4645
"firebase-installations:updateVersion", "firebase-installations:updateDependencyVersion",
47-
"firebase-perf:updateVersion", "firebase-perf:updateDependencyVersion"
46+
"firebase-perf:updateVersion", "firebase-perf:updateDependencyVersion",
47+
"firebase-storage:updateVersion", "firebase-storage:updateDependencyVersion"
4848
)
4949
}
5050
}
@@ -62,7 +62,7 @@ subprojects {
6262
}
6363

6464
tasks.withType<Sign>().configureEach {
65-
onlyIf { project.gradle.startParameter.taskNames.contains("MavenRepository") }
65+
onlyIf { !project.gradle.startParameter.taskNames.any { "MavenLocal" in it } }
6666
}
6767

6868
val skipPublishing = project.name == "test-utils" // skip publishing for test utils
@@ -102,68 +102,9 @@ subprojects {
102102
.replace("firebase-app\": \"([^\"]+)".toRegex(), "firebase-app\": \"${project.property("firebase-app.version")}")
103103
)
104104
}
105-
106-
val copyReadMe by registering(Copy::class) {
107-
from(rootProject.file("README.md"))
108-
into(file("$buildDir/node_module"))
109-
}
110-
111-
val copyPackageJson by registering(Copy::class) {
112-
from(file("package.json"))
113-
into(file("$buildDir/node_module"))
114-
}
115-
116-
val unzipJar by registering(Copy::class) {
117-
val zipFile = File("$buildDir/libs", "${project.name}-js-${project.version}.jar")
118-
from(this.project.zipTree(zipFile))
119-
into("$buildDir/classes/kotlin/js/main/")
120-
}
121-
122-
val copyJS by registering {
123-
mustRunAfter("unzipJar", "copyPackageJson")
124-
doLast {
125-
val from = File("$buildDir/classes/kotlin/js/main/${rootProject.name}-${project.name}.js")
126-
val into = File("$buildDir/node_module/${project.name}.js")
127-
into.createNewFile()
128-
into.writeText(
129-
from.readText()
130-
.replace("require('firebase-kotlin-sdk-", "require('@gitlive/")
131-
// .replace("require('kotlinx-serialization-kotlinx-serialization-runtime')", "require('@gitlive/kotlinx-serialization-runtime')")
132-
)
133-
}
134-
}
135-
136-
val copySourceMap by registering(Copy::class) {
137-
from(file("$buildDir/classes/kotlin/js/main/${project.name}.js.map"))
138-
into(file("$buildDir/node_module"))
139-
}
140-
141-
register("prepareForNpmPublish") {
142-
dependsOn(
143-
unzipJar,
144-
copyPackageJson,
145-
copySourceMap,
146-
copyReadMe,
147-
copyJS
148-
)
149-
}
150-
151-
create<Exec>("publishToNpm") {
152-
workingDir("$buildDir/node_module")
153-
isIgnoreExitValue = true
154-
if(Os.isFamily(Os.FAMILY_WINDOWS)) {
155-
commandLine("cmd", "/c", "npm publish")
156-
} else {
157-
commandLine("npm", "publish")
158-
}
159-
}
160105
}
161106

162107
afterEvaluate {
163-
// create the projects node_modules if they don't exist
164-
if(!File("$buildDir/node_module").exists()) {
165-
mkdir("$buildDir/node_module")
166-
}
167108

168109
val coroutinesVersion: String by project
169110
val firebaseBoMVersion: String by project
@@ -176,7 +117,13 @@ subprojects {
176117
"commonTestImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
177118
"commonTestImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion")
178119
if (this@afterEvaluate.name != "firebase-crashlytics") {
120+
"jvmMainApi"("dev.gitlive:firebase-java-sdk:0.1.1")
121+
"jvmMainApi"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.0") {
122+
exclude("com.google.android.gms")
123+
}
179124
"jsTestImplementation"(kotlin("test-js"))
125+
"jvmTestImplementation"(kotlin("test-junit"))
126+
"jvmTestImplementation"("junit:junit:4.13.2")
180127
}
181128
"androidInstrumentedTestImplementation"(kotlin("test-junit"))
182129
"androidInstrumentedTestImplementation"("junit:junit:4.13.2")
@@ -197,6 +144,9 @@ subprojects {
197144
apply(plugin = "maven-publish")
198145
apply(plugin = "signing")
199146

147+
val javadocJar: TaskProvider<Jar> by tasks.registering(Jar::class) {
148+
archiveClassifier.set("javadoc")
149+
}
200150

201151
configure<PublishingExtension> {
202152

@@ -212,6 +162,7 @@ subprojects {
212162

213163
publications.all {
214164
this as MavenPublication
165+
artifact(javadocJar)
215166

216167
pom {
217168
name.set("firebase-kotlin-sdk")

firebase-app/build.gradle.kts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ kotlin {
5050
publishAllLibraryVariants()
5151
}
5252

53+
jvm {
54+
val main by compilations.getting {
55+
kotlinOptions {
56+
jvmTarget = "17"
57+
}
58+
}
59+
}
5360

5461
if (supportIosTarget) {
5562
ios()
@@ -120,6 +127,10 @@ kotlin {
120127
}
121128
}
122129

130+
val jvmMain by getting {
131+
kotlin.srcDir("src/androidMain/kotlin")
132+
}
133+
123134
if (supportIosTarget) {
124135
val iosMain by getting
125136
val iosSimulatorArm64Main by getting

firebase-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-app",
3-
"version": "1.8.1",
3+
"version": "1.10.0",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-app.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-common": "1.8.1",
26+
"@gitlive/firebase-common": "1.10.0",
2727
"firebase": "9.19.1",
2828
"kotlin": "1.8.20",
2929
"kotlinx-coroutines-core": "1.6.4"

0 commit comments

Comments
 (0)