Skip to content

Commit 106a590

Browse files
authored
Merge pull request #17 from GitLiveApp/encode-defaults
Encode defaults
2 parents b41ef2f + 1b7b8c1 commit 106a590

File tree

44 files changed

+576
-394
lines changed

Some content is hidden

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

44 files changed

+576
-394
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ The Firebase Kotlin SDK uses Kotlin serialization to read and write custom class
6464
```groovy
6565
plugins {
6666
kotlin("multiplatform") // or kotlin("jvm") or any other kotlin plugin
67-
kotlin("plugin.serialization") version "1.3.70"
67+
kotlin("plugin.serialization") version "1.3.72"
6868
}
6969
```
7070

build.gradle.kts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ buildscript {
2020
}
2121

2222
val targetSdkVersion by extra(28)
23-
val minSdkVersion by extra(14)
23+
val minSdkVersion by extra(16)
2424

2525

2626
tasks {
@@ -131,13 +131,24 @@ subprojects {
131131

132132
dependencies {
133133
"commonMainImplementation"(kotlin("stdlib-common"))
134-
"commonMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.4")
134+
"commonMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.5")
135135
"jsMainImplementation"(kotlin("stdlib-js"))
136-
"jsMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:1.3.4")
137-
"androidMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.4")
138-
"androidMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.3.4")
139-
"iosMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.4")
140-
"iosMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.3.4")
136+
"jsMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:1.3.5")
137+
"androidMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5")
138+
"androidMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.3.5")
139+
"iosMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.5")
140+
"iosMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.3.5")
141+
"commonTestImplementation"(kotlin("test-common"))
142+
"commonTestImplementation"(kotlin("test-annotations-common"))
143+
"commonTestImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.5")
144+
"commonTestImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.5")
145+
"jsTestImplementation"(kotlin("test-js"))
146+
"androidAndroidTestImplementation"(kotlin("test-junit"))
147+
"androidAndroidTestImplementation"("junit:junit:4.12")
148+
"androidAndroidTestImplementation"("androidx.test:core:1.2.0")
149+
"androidAndroidTestImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5")
150+
"androidAndroidTestImplementation"("androidx.test.ext:junit:1.1.1")
151+
"androidAndroidTestImplementation"("androidx.test:runner:1.1.0")
141152
}
142153
}
143154

firebase-app/build.gradle.kts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Copyright (c) 2020 GitLive Ltd. Use of this source code is governed by the Apache 2.0 license.
33
*/
4-
version = "0.1.0"
4+
version = "0.2.0"
55

66

77
plugins {
@@ -26,6 +26,14 @@ android {
2626
manifest.srcFile("src/androidMain/AndroidManifest.xml")
2727
}
2828
}
29+
testOptions {
30+
unitTests.apply {
31+
isIncludeAndroidResources = true
32+
}
33+
}
34+
packagingOptions {
35+
pickFirst("META-INF/kotlinx-serialization-runtime.kotlin_module")
36+
}
2937
}
3038

3139
kotlin {
@@ -35,6 +43,8 @@ kotlin {
3543
moduleKind = "commonjs"
3644
}
3745
}
46+
nodejs()
47+
browser()
3848
}
3949
// js("reactnative") {
4050
// val main by compilations.getting {
@@ -56,20 +66,25 @@ kotlin {
5666
implementation(project(":firebase-common"))
5767
}
5868
}
69+
val commonTest by getting {
70+
dependencies {
71+
implementation(kotlin("test-common"))
72+
implementation(kotlin("test-annotations-common"))
73+
}
74+
}
5975
val androidMain by getting {
6076
dependencies {
6177
api("com.google.firebase:firebase-common:19.2.0")
6278
}
6379
}
64-
// val iosMain by creating
6580

6681
configure(listOf(iosArm64, iosX64)) {
6782
compilations.getByName("main") {
6883
source(sourceSets.get("iosMain"))
6984
val firebasecore by cinterops.creating {
7085
packageName("cocoapods.FirebaseCore")
7186
defFile(file("$projectDir/src/iosMain/c_interop/FirebaseCore.def"))
72-
compilerOpts("-F$projectDir/../build/Firebase/FirebaseAnalytics")
87+
compilerOpts("-F${rootProject.buildDir}/Firebase/FirebaseAnalytics")
7388
}
7489
}
7590
}

firebase-app/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@gitlive/firebase-app",
3-
"version": "0.1.0",
4-
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
3+
"version": "0.2.0",
4+
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-app.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1"
@@ -23,10 +23,10 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-common": "0.1.0",
26+
"@gitlive/firebase-common": "0.2.0",
2727
"firebase": "7.14.0",
28-
"kotlin": "1.3.70",
29-
"kotlinx-coroutines-core": "1.3.4"
28+
"kotlin": "1.3.72",
29+
"kotlinx-coroutines-core": "1.3.5"
3030
}
3131
}
3232

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package dev.teamhub.firebase
2+
3+
import kotlin.test.Test
4+
5+
class FirebaseAppTest {
6+
@Test
7+
fun testInitialize() {
8+
Firebase.initialize()
9+
}
10+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
language = Objective-C
22
modules = FirebaseCore
33
compilerOpts = -framework FirebaseCore
4-
linkerOpts = -framework FirebaseCore
4+
linkerOpts = -framework FirebaseCore -framework FIRAnalyticsConnector -framework FirebaseAnalytics -framework FirebaseCore -framework FirebaseCoreDiagnostics -framework FirebaseInstallations -framework FirebaseInstanceID -framework GoogleAppMeasurement -framework GoogleDataTransport -framework GoogleDataTransportCCTSupport -framework GoogleUtilities -framework PromisesObjC -framework nanopb -framework StoreKit -lsqlite3

firebase-app/src/iosMain/kotlin/dev/gitlive/firebase/firebase.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ actual fun Firebase.apps(context: Any?) = FIRApp.allApps()
3838
.values
3939
.map { FirebaseApp(it as FIRApp) }
4040

41-
private fun FirebaseOptions.toIos() = FIROptions().apply {
42-
bundleID = this@toIos.applicationId
41+
private fun FirebaseOptions.toIos() = FIROptions(this@toIos.applicationId, "846484016111").apply {
4342
APIKey = this@toIos.apiKey
4443
databaseURL = this@toIos.databaseUrl
4544
trackingID = this@toIos.gaTrackingId

firebase-auth/build.gradle.kts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,21 @@ android {
1111
defaultConfig {
1212
minSdkVersion(property("minSdkVersion") as Int)
1313
targetSdkVersion(property("targetSdkVersion") as Int)
14+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
1415
}
1516
sourceSets {
1617
getByName("main") {
1718
manifest.srcFile("src/androidMain/AndroidManifest.xml")
1819
}
20+
getByName("androidTest").java.srcDir(file("src/androidAndroidTest/kotlin"))
21+
}
22+
testOptions {
23+
unitTests.apply {
24+
isIncludeAndroidResources = true
25+
}
26+
}
27+
packagingOptions {
28+
pickFirst("META-INF/kotlinx-serialization-runtime.kotlin_module")
1929
}
2030
}
2131

@@ -26,12 +36,24 @@ kotlin {
2636
moduleKind = "commonjs"
2737
}
2838
}
39+
nodejs()
40+
browser()
2941
}
3042
android {
3143
publishLibraryVariants("release", "debug")
3244
}
3345
val iosArm64 = iosArm64()
34-
val iosX64 = iosX64("ios")
46+
val iosX64 = iosX64("ios") {
47+
binaries {
48+
getTest("DEBUG").apply {
49+
linkerOpts("-F${rootProject.buildDir}/Firebase/FirebaseAnalytics")
50+
linkerOpts("-F${rootProject.buildDir}/Firebase/FirebaseAuth")
51+
linkerOpts("-F${rootProject.buildDir}/Firebase/GoogleSignIn")
52+
linkerOpts("-ObjC")
53+
// compilerOpts("-framework AppAuth")
54+
}
55+
}
56+
}
3557

3658
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
3759
kotlinOptions.freeCompilerArgs += listOf(
@@ -53,15 +75,15 @@ kotlin {
5375
api("com.google.firebase:firebase-auth:19.1.0")
5476
}
5577
}
56-
// val iosMain by creating
57-
78+
5879
configure(listOf(iosArm64, iosX64)) {
5980
compilations.getByName("main") {
6081
source(sourceSets.get("iosMain"))
6182
val firebaseAuth by cinterops.creating {
6283
packageName("cocoapods.FirebaseAuth")
6384
defFile(file("$projectDir/src/iosMain/c_interop/FirebaseAuth.def"))
6485
compilerOpts("-F$projectDir/../build/Firebase/FirebaseAuth")
86+
compilerOpts("-F$projectDir/../build/Firebase/GoogleSignIn")
6587
}
6688
}
6789
}
@@ -70,6 +92,7 @@ kotlin {
7092
summary = ""
7193
homepage = ""
7294
}
95+
7396
}
7497
}
7598

firebase-auth/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@gitlive/firebase-auth",
3-
"version": "0.1.0",
4-
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
3+
"version": "0.2.0",
4+
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-auth.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1"
@@ -23,10 +23,10 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-app": "0.1.0",
26+
"@gitlive/firebase-app": "0.2.0",
2727
"firebase": "7.14.0",
28-
"kotlin": "1.3.70",
29-
"kotlinx-coroutines-core": "1.3.4"
28+
"kotlin": "1.3.72",
29+
"kotlinx-coroutines-core": "1.3.5"
3030
}
3131
}
3232

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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.auth
7+
8+
import androidx.test.platform.app.InstrumentationRegistry
9+
import kotlinx.coroutines.runBlocking
10+
11+
actual val context: Any = InstrumentationRegistry.getInstrumentation().targetContext
12+
13+
actual fun runTest(test: suspend () -> Unit) = runBlocking { test() }

0 commit comments

Comments
 (0)