Skip to content

Commit 1c151da

Browse files
committed
Merge remote-tracking branch 'origin/master' into make-android-ios-js-properties-extensions
# Conflicts: # firebase-app/src/jsMain/kotlin/dev/gitlive/firebase/firebase.kt # firebase-auth/src/jsMain/kotlin/dev/gitlive/firebase/auth/auth.kt # firebase-auth/src/jsMain/kotlin/dev/gitlive/firebase/auth/credentials.kt # firebase-auth/src/jsMain/kotlin/dev/gitlive/firebase/auth/multifactor.kt # firebase-auth/src/jsMain/kotlin/dev/gitlive/firebase/auth/user.kt # firebase-config/src/jsMain/kotlin/dev/gitlive/firebase/remoteconfig/FirebaseRemoteConfig.kt # firebase-config/src/jsMain/kotlin/dev/gitlive/firebase/remoteconfig/FirebaseRemoteConfigValue.kt # firebase-database/src/jsMain/kotlin/dev/gitlive/firebase/database/database.kt # firebase-firestore/src/jsMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt # firebase-firestore/src/jsMain/kotlin/dev/gitlive/firebase/firestore/internal/NativeQueryWrapper.kt # firebase-firestore/src/jsMain/kotlin/dev/gitlive/firebase/firestore/internal/NativeTransactionWrapper.kt # firebase-functions/src/jsMain/kotlin/dev/gitlive/firebase/functions/functions.kt # firebase-installations/src/jsMain/kotlin/dev/gitlive/firebase/installations/installations.kt # firebase-perf/src/jsMain/kotlin/dev/gitlive/firebase/perf/metrics/Trace.kt # firebase-perf/src/jsMain/kotlin/dev/gitlive/firebase/perf/performance.kt # firebase-storage/src/jsMain/kotlin/dev/gitlive/firebase/storage/storage.kt # gradle.properties
2 parents c426c5c + 70d0514 commit 1c151da

File tree

291 files changed

+8968
-4142
lines changed

Some content is hidden

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

291 files changed

+8968
-4142
lines changed

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
root = true
2+
3+
[*.{kt,kts}]
4+
ktlint_code_style = intellij_idea
5+
ktlint_ignore_back_ticked_identifier = true
6+
7+
ktlint_standard = enabled
8+
ktlint_standard_no-wildcard-imports = disabled
9+
ktlint_standard_filename = disabled
10+
ktlint_standard_import-ordering = disabled
11+
ktlint_standard_function-naming = disabled
12+
13+
ktlint_experimental = disabled
14+

.github/workflows/pull_request.yml

Lines changed: 57 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,26 @@ on:
88
branches: [ master ]
99

1010
jobs:
11-
jobEmulatorMatrixSetup:
11+
lint:
1212
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Set up JDK
16+
uses: actions/setup-java@v4
17+
with:
18+
distribution: 'zulu'
19+
java-version: '17'
20+
- name: ktLint
21+
run: ./gradlew lintKotlin
22+
- name: run apiCheck
23+
run: ./gradlew apiCheck
24+
jobMatrixSetup:
25+
runs-on: macos-latest
1326
outputs:
1427
emulator_jobs_matrix: ${{ steps.dataStep.outputs.emulator_jobs_matrix }}
28+
ios_test_jobs_matrix: ${{ steps.dataStep.outputs.ios_test_jobs_matrix }}
29+
js_test_jobs_matrix: ${{ steps.dataStep.outputs.js_test_jobs_matrix }}
30+
jvm_test_jobs_matrix: ${{ steps.dataStep.outputs.jvm_test_jobs_matrix }}
1531
steps:
1632
- uses: actions/checkout@v4
1733
- name: Set up JDK
@@ -21,15 +37,21 @@ jobs:
2137
java-version: '17'
2238
cache: gradle
2339
- name: Prepare the matrix JSON
24-
run: ./gradlew ciEmulatorJobsMatrixSetup
40+
run: ./gradlew ciJobsMatrixSetup
2541
- id: dataStep
26-
run: echo "emulator_jobs_matrix=$(jq -c . < ./build/emulator_jobs_matrix.json)" >> $GITHUB_OUTPUT
42+
run: |
43+
echo "
44+
emulator_jobs_matrix=$(jq -c . < ./build/emulator_jobs_matrix.json)
45+
ios_test_jobs_matrix=$(jq -c . < ./build/ios_test_jobs_matrix.json)
46+
js_test_jobs_matrix=$(jq -c . < ./build/js_test_jobs_matrix.json)
47+
jvm_test_jobs_matrix=$(jq -c . < ./build/jvm_test_jobs_matrix.json)
48+
" >> $GITHUB_OUTPUT
2749
build-android:
28-
needs: jobEmulatorMatrixSetup
50+
needs: jobMatrixSetup
2951
runs-on: ubuntu-latest
3052
strategy:
3153
fail-fast: false
32-
matrix: ${{ fromJson(needs.jobEmulatorMatrixSetup.outputs.emulator_jobs_matrix) }}
54+
matrix: ${{ fromJson(needs.jobMatrixSetup.outputs.emulator_jobs_matrix) }}
3355
steps:
3456
- uses: actions/checkout@v4
3557
- name: Enable KVM group perms
@@ -59,19 +81,26 @@ jobs:
5981
name: Android ${{ env.ARCHIVE_KEY }} Firebase Debug Log
6082
path: "**/firebase-debug.log"
6183
build-js:
84+
needs: jobMatrixSetup
6285
runs-on: ubuntu-latest
86+
strategy:
87+
fail-fast: false
88+
matrix: ${{ fromJson(needs.jobMatrixSetup.outputs.js_test_jobs_matrix) }}
6389
steps:
6490
- uses: actions/checkout@v4
6591
- name: Setup test environment
6692
uses: ./.github/actions/setup_test_action
6793
timeout-minutes: 10
94+
- name: Set Artifact Name
95+
run: |
96+
echo "ARCHIVE_KEY=$(echo ${{ matrix.gradle_tasks }} | cut -d: -f2)" >> $GITHUB_ENV
6897
- name: Run JS Tests
69-
run: ./gradlew cleanTest jsTest
98+
run: ./gradlew ${{ matrix.gradle_tasks }}
7099
- name: Upload JS test artifact
71100
uses: actions/upload-artifact@v4
72101
if: failure()
73102
with:
74-
name: "JS Test Report HTML"
103+
name: JS ${{ env.ARCHIVE_KEY }} Test Report HTML
75104
path: |
76105
**/build/reports/tests/jsTest/
77106
**/build/reports/tests/jsBrowserTest/
@@ -80,10 +109,14 @@ jobs:
80109
uses: actions/upload-artifact@v4
81110
if: failure()
82111
with:
83-
name: "JS Firebase Debug Log"
112+
name: JS ${{ env.ARCHIVE_KEY }} Firebase Debug Log
84113
path: "**/firebase-debug.log"
85114
build-ios:
115+
needs: jobMatrixSetup
86116
runs-on: macos-latest
117+
strategy:
118+
fail-fast: false
119+
matrix: ${{ fromJson(needs.jobMatrixSetup.outputs.ios_test_jobs_matrix) }}
87120
steps:
88121
- uses: actions/checkout@v4
89122
- name: Cocoapods cache
@@ -97,39 +130,49 @@ jobs:
97130
key: cocoapods-cache-v2
98131
- name: Setup test environment
99132
uses: ./.github/actions/setup_test_action
133+
- name: Set Artifact Name
134+
run: |
135+
echo "ARCHIVE_KEY=$(echo ${{ matrix.gradle_tasks }} | cut -d: -f2)" >> $GITHUB_ENV
100136
- name: Run iOS Tests
101-
run: ./gradlew cleanTest iosSimulatorArm64Test
137+
run: ./gradlew ${{ matrix.gradle_tasks }}
102138
- name: Upload iOS test artifact
103139
uses: actions/upload-artifact@v4
104140
if: failure()
105141
with:
106-
name: "iOS Test Report HTML"
142+
name: iOS ${{ env.ARCHIVE_KEY }} Test Report HTML
107143
path: "**/build/reports/tests/iosSimulatorArm64Test/"
108144
- name: Upload Firebase Debug Log
109145
uses: actions/upload-artifact@v4
110146
if: failure()
111147
with:
112-
name: "iOS Firebase Debug Log"
148+
name: iOS ${{ env.ARCHIVE_KEY }} Firebase Debug Log
113149
path: "**/firebase-debug.log"
114150
build-jvm:
151+
needs: jobMatrixSetup
115152
runs-on: ubuntu-latest
153+
strategy:
154+
fail-fast: false
155+
matrix: ${{ fromJson(needs.jobMatrixSetup.outputs.jvm_test_jobs_matrix) }}
116156
steps:
117157
- uses: actions/checkout@v4
118158
- name: Setup test environment
119159
uses: ./.github/actions/setup_test_action
120160
timeout-minutes: 10
161+
- name: Set Artifact Name
162+
run: |
163+
echo "ARCHIVE_KEY=$(echo ${{ matrix.gradle_tasks }} | cut -d: -f2)" >> $GITHUB_ENV
121164
- name: Run JVM Tests
122-
run: ./gradlew cleanTest jvmTest
165+
run: ./gradlew ${{ matrix.gradle_tasks }}
123166
- name: Upload JVM test artifact
124167
uses: actions/upload-artifact@v4
125168
if: failure()
126169
with:
127-
name: "JVM Test Report HTML"
170+
name: JVM ${{ env.ARCHIVE_KEY }} Test Report HTML
128171
path: |
129172
**/build/reports/tests/jvmTest/
130173
- name: Upload Firebase Debug Log
131174
uses: actions/upload-artifact@v4
132175
if: failure()
133176
with:
134-
name: "JVM Firebase Debug Log"
177+
name: JVM ${{ env.ARCHIVE_KEY }} Firebase Debug Log
135178
path: "**/firebase-debug.log"

.github/workflows/push.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Push
2+
3+
on: [ push ]
4+
5+
jobs:
6+
formatKotlin:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: write
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
ref: ${{ github.head_ref }}
14+
- name: Set up JDK
15+
uses: actions/setup-java@v4
16+
with:
17+
distribution: 'zulu'
18+
java-version: '17'
19+
- name: formatKotlin
20+
run: ./gradlew formatKotlin
21+
- uses: stefanzweifel/git-auto-commit-action@v5
22+
- name: lintKotlin
23+
run: ./gradlew lintKotlin

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ The following libraries are available for the various Firebase products.
2121
| [Realtime Database](https://firebase.google.com/docs/database) | [`dev.gitlive:firebase-database:1.13.0`](https://search.maven.org/artifact/dev.gitlive/firebase-database/1.13.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) |
2222
| [Cloud Firestore](https://firebase.google.com/docs/firestore) | [`dev.gitlive:firebase-firestore:1.13.0`](https://search.maven.org/artifact/dev.gitlive/firebase-firestore/1.13.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) |
2323
| [Cloud Functions](https://firebase.google.com/docs/functions) | [`dev.gitlive:firebase-functions:1.13.0`](https://search.maven.org/artifact/dev.gitlive/firebase-functions/1.13.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) |
24-
| [Cloud Messaging](https://firebase.google.com/docs/cloud-messaging) | [`dev.gitlive:firebase-messaging:1.13.0`](https://search.maven.org/artifact/dev.gitlive/firebase-messaging/1.13.0/pom) | [![1%](https://img.shields.io/badge/-0%25-lightgrey?style=flat-square)](/firebase-messaging/src/commonMain/kotlin/dev/gitlive/firebase/messaging/messaging.kt) |
24+
| [Cloud Messaging](https://firebase.google.com/docs/cloud-messaging) | [`dev.gitlive:firebase-messaging:1.13.0`](https://search.maven.org/artifact/dev.gitlive/firebase-messaging/1.13.0/pom) | [![1%](https://img.shields.io/badge/-10%25-orange?style=flat-square)](/firebase-messaging/src/commonMain/kotlin/dev/gitlive/firebase/messaging/messaging.kt) |
2525
| [Cloud Storage](https://firebase.google.com/docs/storage) | [`dev.gitlive:firebase-storage:1.13.0`](https://search.maven.org/artifact/dev.gitlive/firebase-storage/1.13.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) |
2626
| [Installations](https://firebase.google.com/docs/projects/manage-installations) | [`dev.gitlive:firebase-installations:1.13.0`](https://search.maven.org/artifact/dev.gitlive/firebase-installations/1.13.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) |
2727
| [Remote Config](https://firebase.google.com/docs/remote-config) | [`dev.gitlive:firebase-config:1.13.0`](https://search.maven.org/artifact/dev.gitlive/firebase-config/1.13.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) |
28-
| [Performance](https://firebase.google.com/docs/perf-mon) | [`dev.gitlive:firebase-perf:1.13.0`](https://search.maven.org/artifact/dev.gitlive/firebase-perf/1.13.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) |
29-
| [Crashlytics](https://firebase.google.com/docs/crashlytics) | [`dev.gitlive:firebase-crashlytics:1.13.0`](https://search.maven.org/artifact/dev.gitlive/firebase-crashlytics/1.13.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) |
28+
| [Performance](https://firebase.google.com/docs/perf-mon) | [`dev.gitlive:firebase-perf:1.13.0`](https://search.maven.org/artifact/dev.gitlive/firebase-perf/1.13.0/pom) | [![1%](https://img.shields.io/badge/-10%25-orange?style=flat-square)](/firebase-perf/src/commonMain/kotlin/dev/gitlive/firebase/perf/performance.kt) |
29+
| [Crashlytics](https://firebase.google.com/docs/crashlytics) | [`dev.gitlive:firebase-crashlytics:1.13.0`](https://search.maven.org/artifact/dev.gitlive/firebase-crashlytics/1.13.0/pom) | [![80%](https://img.shields.io/badge/-10%25-orange?style=flat-square)](/firebase-crashlytics/src/commonMain/kotlin/dev/gitlive/firebase/crashlytics/crashlytics.kt) |
3030

3131
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)
3232

@@ -293,10 +293,12 @@ To run the tests you can use the following gradle tasks:
293293

294294
`./gradlew connectedAndroidTest` (an emulator needs to be running)
295295

296-
`./gradlew iosSimulatorArm64Test`
296+
`./gradlew iosSimulatorArm64Test` (On Apple Chip) `./gradlew iosX64Test` (On Intel Chip)
297297

298298
`./gradlew jsNodeTest`
299299

300+
`./gradlew jvmTest`
301+
300302
For some tests you need to have the firebase emulator suite running. After installing them you can run the following command inside the `test` directory:
301303

302304
`firebase emulators:start`
@@ -305,6 +307,17 @@ For some tests you need to have the firebase emulator suite running. After insta
305307
For every publicly available class or function there needs to be documentation written in the [KDoc syntax](https://kotlinlang.org/docs/kotlin-doc.html).
306308
We publish a new version of the documentation after every release and can be found [here](https://gitliveapp.github.io/firebase-kotlin-sdk/)
307309

310+
### Validation
311+
To ensure changes to the public API are well documented, this library validates its binary API. If you make changes to the API, make sure to run
312+
313+
`./gradlew apiDump`
314+
315+
### Code style
316+
This library uses the [Intellij Kotlin code style](https://www.jetbrains.com/help/idea/code-style-kotlin.html). Run the linter to make sure you follow these styles.
317+
318+
`./gradlew formatKotlin` to format to the proper style
319+
`./gradlew lintKotlin` to validate the correct style is used
320+
308321
### Compatibility with the official [Firebase Android SDK](https://github.com/firebase/firebase-android-sdk)
309322

310323
When this project began, the official Firebase Android SDK was a pure java library and the separate Kotlin extensions (KTX) module consisted of only a few extensions providing some syntactic sugar, for example `Firebase.firestore` instead of `Firebase.getInstance(),` which we naturally copied for the Firebase Kotlin SDK.

build.gradle.kts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ plugins {
1616
alias(libs.plugins.native.cocoapods) apply false
1717
alias(libs.plugins.test.logger.plugin) apply false
1818
alias(libs.plugins.ben.manes.versions) apply false
19+
alias(libs.plugins.kotlinter) apply false
20+
alias(libs.plugins.kotlinx.binarycompatibilityvalidator)
1921
alias(libs.plugins.dokka)
2022
id("base")
2123
id("testOptionsConvention")
@@ -41,8 +43,8 @@ tasks {
4143
"firebase-database:updateVersion", "firebase-database:updateDependencyVersion",
4244
"firebase-firestore:updateVersion", "firebase-firestore:updateDependencyVersion",
4345
"firebase-functions:updateVersion", "firebase-functions:updateDependencyVersion",
44-
"firebase-messaging:updateVersion", "firebase-messaging:updateDependencyVersion",
4546
"firebase-installations:updateVersion", "firebase-installations:updateDependencyVersion",
47+
"firebase-messaging:updateVersion", "firebase-messaging:updateDependencyVersion",
4648
"firebase-perf:updateVersion", "firebase-perf:updateDependencyVersion",
4749
"firebase-storage:updateVersion", "firebase-storage:updateDependencyVersion"
4850
)
@@ -104,6 +106,7 @@ subprojects {
104106
}
105107

106108
apply(plugin = "com.adarshr.test-logger")
109+
apply(plugin = "org.jmailen.kotlinter")
107110

108111
repositories {
109112
mavenLocal()
@@ -268,26 +271,32 @@ tasks.withType<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
268271
}
269272
// check for latest dependencies - ./gradlew dependencyUpdates -Drevision=release
270273

271-
tasks.register("devRunEmulatorTests") {
274+
tasks.register("devRunAllTests") {
272275
doLast {
273-
EmulatorJobsMatrix().getTaskList(rootProject = rootProject).forEach { gradleTasks ->
276+
val gradleTasks = mutableListOf<List<String>>()
277+
gradleTasks.addAll(EmulatorJobsMatrix().getJvmTestTaskList(rootProject = rootProject))
278+
gradleTasks.addAll(EmulatorJobsMatrix().getJsTestTaskList(rootProject = rootProject))
279+
gradleTasks.addAll(EmulatorJobsMatrix().getIosTestTaskList(rootProject = rootProject))
280+
gradleTasks.add(listOf("ciSdkManagerLicenses"))
281+
gradleTasks.addAll(EmulatorJobsMatrix().getEmulatorTaskList(rootProject = rootProject))
282+
gradleTasks.forEach {
274283
exec {
275284
executable = File(
276285
project.rootDir,
277286
if (Os.isFamily(Os.FAMILY_WINDOWS)) "gradlew.bat" else "gradlew",
278287
)
279288
.also { it.setExecutable(true) }
280289
.absolutePath
281-
args = gradleTasks
290+
args = it
282291
println("exec: ${this.commandLine.joinToString(separator = " ")}")
283292
}.apply { println("ExecResult: $this") }
284293
}
285294
}
286295
}
287296

288-
tasks.register("ciEmulatorJobsMatrixSetup") {
297+
tasks.register("ciJobsMatrixSetup") {
289298
doLast {
290-
EmulatorJobsMatrix().createMatrixJsonFile(rootProject = rootProject)
299+
EmulatorJobsMatrix().createMatrixJsonFiles(rootProject = rootProject)
291300
}
292301
}
293302

0 commit comments

Comments
 (0)