Skip to content

Commit ce715f2

Browse files
authoredMar 15, 2023
Added crashlytics (#358)
1 parent 069dcb3 commit ce715f2

File tree

27 files changed

+512
-48
lines changed

27 files changed

+512
-48
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ Firebase*.zip
1818

1919
/**/nativeInterop/cinterop/Cartfile.resolved
2020
/**/nativeInterop/cinterop/Carthage/
21+
/kotlin-js-store/yarn.lock

‎README.md

+22-20
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@ The Firebase Kotlin SDK is a Kotlin-first SDK for Firebase. It's API is similar
1010

1111
The following libraries are available for the various Firebase products.
1212

13-
| Service or Product | Gradle Dependency | API Coverage |
14-
|---------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
15-
| [Authentication](https://firebase.google.com/docs/auth) | [`dev.gitlive:firebase-auth:1.7.0`](https://search.maven.org/artifact/dev.gitlive/firebase-auth/1.7.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.7.0`](https://search.maven.org/artifact/dev.gitlive/firebase-database/1.7.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.7.0`](https://search.maven.org/artifact/dev.gitlive/firebase-firestore/1.7.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.7.0`](https://search.maven.org/artifact/dev.gitlive/firebase-functions/1.7.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.7.0`](https://search.maven.org/artifact/dev.gitlive/firebase-messaging/1.7.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.7.0`](https://search.maven.org/artifact/dev.gitlive/firebase-storage/1.7.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.7.0`](https://search.maven.org/artifact/dev.gitlive/firebase-installations/1.7.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.7.0`](https://search.maven.org/artifact/dev.gitlive/firebase-config/1.7.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.7.0`](https://search.maven.org/artifact/dev.gitlive/firebase-perf/1.7.0/pom) | ![1%](https://img.shields.io/badge/-1%25-orange?style=flat-square) |
13+
| Service or Product | Gradle Dependency | API Coverage |
14+
|---------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
15+
| [Authentication](https://firebase.google.com/docs/auth) | [`dev.gitlive:firebase-auth:1.7.1`](https://search.maven.org/artifact/dev.gitlive/firebase-auth/1.7.1/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.7.1`](https://search.maven.org/artifact/dev.gitlive/firebase-database/1.7.1/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.7.1`](https://search.maven.org/artifact/dev.gitlive/firebase-firestore/1.7.1/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.7.1`](https://search.maven.org/artifact/dev.gitlive/firebase-functions/1.7.1/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.7.1`](https://search.maven.org/artifact/dev.gitlive/firebase-messaging/1.7.1/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.7.1`](https://search.maven.org/artifact/dev.gitlive/firebase-storage/1.7.1/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.7.1`](https://search.maven.org/artifact/dev.gitlive/firebase-installations/1.7.1/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.7.1`](https://search.maven.org/artifact/dev.gitlive/firebase-config/1.7.1/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.7.1`](https://search.maven.org/artifact/dev.gitlive/firebase-perf/1.7.1/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.7.1`](https://search.maven.org/artifact/dev.gitlive/firebase-crashlytics/1.7.1/pom) | ![80%](https://img.shields.io/badge/-1%25-orange?style=flat-square) |
2425

2526

2627

@@ -202,15 +203,16 @@ If you are building a Kotlin multiplatform library which will be consumed from J
202203

203204
```json
204205
"dependencies": {
205-
"@gitlive/firebase-auth": "1.7.0",
206-
"@gitlive/firebase-config": "1.7.0",
207-
"@gitlive/firebase-database": "1.7.0",
208-
"@gitlive/firebase-firestore": "1.7.0",
209-
"@gitlive/firebase-functions": "1.7.0",
210-
"@gitlive/firebase-installations": "1.7.0",
211-
"@gitlive/firebase-messaging": "1.7.0",
212-
"@gitlive/firebase-storage": "1.7.0"
213-
"@gitlive/firebase-perf": "1.7.0"
206+
"@gitlive/firebase-auth": "1.7.1",
207+
"@gitlive/firebase-config": "1.7.1",
208+
"@gitlive/firebase-database": "1.7.1",
209+
"@gitlive/firebase-firestore": "1.7.1",
210+
"@gitlive/firebase-functions": "1.7.1",
211+
"@gitlive/firebase-installations": "1.7.1",
212+
"@gitlive/firebase-messaging": "1.7.1",
213+
"@gitlive/firebase-storage": "1.7.1"
214+
"@gitlive/firebase-perf": "1.7.1"
215+
"@gitlive/firebase-crashlytics": "1.7.1"
214216
}
215217
```
216218

‎build.gradle.kts

+3-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,9 @@ subprojects {
210210
"commonTestImplementation"(kotlin("test-common"))
211211
"commonTestImplementation"(kotlin("test-annotations-common"))
212212
"commonTestImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1-native-mt")
213-
"jsTestImplementation"(kotlin("test-js"))
213+
if (this@afterEvaluate.name != "firebase-crashlytics") {
214+
"jsTestImplementation"(kotlin("test-js"))
215+
}
214216
"androidAndroidTestImplementation"(kotlin("test-junit"))
215217
"androidAndroidTestImplementation"("junit:junit:4.13.2")
216218
"androidAndroidTestImplementation"("androidx.test:core:1.4.0")

‎firebase-app/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-app",
3-
"version": "1.7.0",
3+
"version": "1.7.1",
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.7.0",
26+
"@gitlive/firebase-common": "1.7.1",
2727
"firebase": "9.7.0",
2828
"kotlin": "1.6.10",
2929
"kotlinx-coroutines-core": "1.6.1-native-mt"

‎firebase-auth/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-auth",
3-
"version": "1.7.0",
3+
"version": "1.7.1",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-auth.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-app": "1.7.0",
26+
"@gitlive/firebase-app": "1.7.1",
2727
"firebase": "9.7.0",
2828
"kotlin": "1.6.10",
2929
"kotlinx-coroutines-core": "1.6.1-native-mt"

‎firebase-common/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-common",
3-
"version": "1.7.0",
3+
"version": "1.7.1",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-common.js",
66
"scripts": {

‎firebase-config/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-config",
3-
"version": "1.7.0",
3+
"version": "1.7.1",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-config.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-app": "1.7.0",
26+
"@gitlive/firebase-app": "1.7.1",
2727
"firebase": "9.7.0",
2828
"kotlin": "1.6.10",
2929
"kotlinx-coroutines-core": "1.6.1-native-mt"

‎firebase-crashlytics/build.gradle.kts

+153
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
/*
2+
* Copyright (c) 2020 GitLive Ltd. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
6+
import org.jetbrains.kotlin.konan.target.KonanTarget
7+
8+
version = project.property("firebase-crashlytics.version") as String
9+
10+
plugins {
11+
id("com.android.library")
12+
kotlin("multiplatform")
13+
}
14+
15+
android {
16+
compileSdk = property("targetSdkVersion") as Int
17+
defaultConfig {
18+
minSdk = property("minSdkVersion") as Int
19+
targetSdk = property("targetSdkVersion") as Int
20+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
21+
multiDexEnabled = true
22+
}
23+
sourceSets {
24+
getByName("main") {
25+
manifest.srcFile("src/androidMain/AndroidManifest.xml")
26+
}
27+
getByName("androidTest"){
28+
java.srcDir(file("src/androidAndroidTest/kotlin"))
29+
manifest.srcFile("src/androidAndroidTest/AndroidManifest.xml")
30+
}
31+
}
32+
testOptions {
33+
unitTests.apply {
34+
isIncludeAndroidResources = true
35+
}
36+
}
37+
packagingOptions {
38+
resources.pickFirsts.add("META-INF/kotlinx-serialization-core.kotlin_module")
39+
resources.pickFirsts.add("META-INF/AL2.0")
40+
resources.pickFirsts.add("META-INF/LGPL2.1")
41+
}
42+
lint {
43+
abortOnError = false
44+
}
45+
}
46+
47+
val KonanTarget.archVariant: String
48+
get() = if (this is KonanTarget.IOS_X64 || this is KonanTarget.IOS_SIMULATOR_ARM64) {
49+
"ios-arm64_i386_x86_64-simulator"
50+
} else {
51+
"ios-arm64_armv7"
52+
}
53+
54+
kotlin {
55+
56+
android {
57+
publishAllLibraryVariants()
58+
}
59+
60+
val supportIosTarget = project.property("skipIosTarget") != "true"
61+
if (supportIosTarget) {
62+
63+
fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = {
64+
val nativeFrameworkPaths = listOf(
65+
rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/iOS")
66+
).plus(
67+
listOf(
68+
"FirebaseAnalytics",
69+
"FirebaseCore",
70+
"FirebaseCoreDiagnostics",
71+
"FirebaseInstallations",
72+
"GoogleAppMeasurement",
73+
"GoogleAppMeasurementIdentitySupport",
74+
"GoogleDataTransport",
75+
"GoogleUtilities",
76+
"nanopb",
77+
"PromisesObjC"
78+
).map {
79+
rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}")
80+
}
81+
).plus(
82+
listOf(
83+
"FirebaseCrashlytics"
84+
).map {
85+
projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}")
86+
}
87+
)
88+
binaries {
89+
getTest("DEBUG").apply {
90+
linkerOpts(nativeFrameworkPaths.map { "-F$it" })
91+
linkerOpts("-ObjC")
92+
}
93+
}
94+
95+
compilations.getByName("main") {
96+
cinterops.create("FirebaseCrashlytics") {
97+
compilerOpts(nativeFrameworkPaths.map { "-F$it" })
98+
extraOpts = listOf("-compiler-option", "-DNS_FORMAT_ARGUMENT(A)=", "-verbose")
99+
}
100+
}
101+
}
102+
103+
ios(configure = nativeTargetConfig())
104+
iosSimulatorArm64(configure = nativeTargetConfig())
105+
}
106+
107+
sourceSets {
108+
all {
109+
languageSettings.apply {
110+
apiVersion = "1.6"
111+
languageVersion = "1.6"
112+
progressiveMode = true
113+
optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
114+
}
115+
}
116+
117+
val commonMain by getting {
118+
dependencies {
119+
api(project(":firebase-app"))
120+
implementation(project(":firebase-common"))
121+
}
122+
}
123+
124+
val androidMain by getting {
125+
dependencies {
126+
api("com.google.firebase:firebase-crashlytics")
127+
}
128+
}
129+
130+
if (supportIosTarget) {
131+
val iosMain by getting
132+
val iosSimulatorArm64Main by getting
133+
iosSimulatorArm64Main.dependsOn(iosMain)
134+
135+
val iosTest by sourceSets.getting
136+
val iosSimulatorArm64Test by sourceSets.getting
137+
iosSimulatorArm64Test.dependsOn(iosTest)
138+
}
139+
}
140+
}
141+
142+
if (project.property("firebase-crashlytics.skipIosTests") == "true") {
143+
tasks.forEach {
144+
if (it.name.contains("ios", true) && it.name.contains("test", true)) { it.enabled = false }
145+
}
146+
}
147+
148+
signing {
149+
val signingKey: String? by project
150+
val signingPassword: String? by project
151+
useInMemoryPgpKeys(signingKey, signingPassword)
152+
sign(publishing.publications)
153+
}

‎firebase-crashlytics/package.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "@gitlive/firebase-crashlytics",
3+
"version": "1.7.1",
4+
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
5+
"main": "firebase-crashlytics.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/GitLiveApp/firebase-kotlin-sdk.git"
12+
},
13+
"keywords": [
14+
"kotlin",
15+
"multiplatform",
16+
"kotlin-js",
17+
"firebase"
18+
],
19+
"author": "dev.gitlive",
20+
"license": "Apache-2.0",
21+
"bugs": {
22+
"url": "https://github.com/GitLiveApp/firebase-kotlin-sdk/issues"
23+
},
24+
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
25+
"dependencies": {
26+
"@gitlive/firebase-app": "1.7.1",
27+
"firebase": "9.7.0",
28+
"kotlin": "1.6.10",
29+
"kotlinx-coroutines-core": "1.6.1-native-mt"
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="dev.gitlive.firebase.crashlytics">
3+
4+
<application android:usesCleartextTraffic="true" />
5+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (c) 2020 GitLive Ltd. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
@file:JvmName("tests")
6+
package dev.gitlive.firebase.crashlytics
7+
8+
import androidx.test.platform.app.InstrumentationRegistry
9+
import kotlinx.coroutines.CoroutineScope
10+
import kotlinx.coroutines.runBlocking
11+
12+
actual val emulatorHost: String = "10.0.2.2"
13+
14+
actual val context: Any = InstrumentationRegistry.getInstrumentation().targetContext
15+
16+
actual fun runTest(test: suspend CoroutineScope.() -> Unit) = runBlocking { test() }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="com.crashlytics.android.build_id">1</string>
3+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<manifest package="dev.gitlive.firebase.crashlytics"/>

0 commit comments

Comments
 (0)
Failed to load comments.