From f76978b738633361cbaca211a9f4bdc02e629225 Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Mon, 4 Oct 2021 16:15:11 +0100 Subject: [PATCH 01/19] Added properties to skip iostarget and skip ios tests. --- firebase-app/build.gradle.kts | 82 ++++++++++++---------- firebase-auth/build.gradle.kts | 96 ++++++++++++++------------ firebase-common/build.gradle.kts | 25 ++++--- firebase-config/build.gradle.kts | 85 +++++++++++++---------- firebase-database/build.gradle.kts | 95 +++++++++++++------------ firebase-firestore/build.gradle.kts | 103 +++++++++++++++------------- firebase-functions/build.gradle.kts | 95 +++++++++++++------------ gradle.properties | 3 + 8 files changed, 326 insertions(+), 258 deletions(-) diff --git a/firebase-app/build.gradle.kts b/firebase-app/build.gradle.kts index a45a18ca9..45cafc56a 100644 --- a/firebase-app/build.gradle.kts +++ b/firebase-app/build.gradle.kts @@ -57,42 +57,48 @@ kotlin { publishAllLibraryVariants() } - fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { - val nativeFrameworkPaths = listOf( - projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/iOS") - ).plus( - listOf( - "FirebaseAnalytics", - "FirebaseCore", - "FirebaseCoreDiagnostics", - "FirebaseInstallations", - "GoogleAppMeasurement", - "GoogleDataTransport", - "GoogleUtilities", - "nanopb", - "PromisesObjC" - ).map { - projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") - } - ) + val supportIosTarget = project.property("skipIosTarget") != "true" + val runIosTests = project.property("skipIosTests") != "true" + + if (supportIosTarget) { + + fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { + val nativeFrameworkPaths = listOf( + projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/iOS") + ).plus( + listOf( + "FirebaseAnalytics", + "FirebaseCore", + "FirebaseCoreDiagnostics", + "FirebaseInstallations", + "GoogleAppMeasurement", + "GoogleDataTransport", + "GoogleUtilities", + "nanopb", + "PromisesObjC" + ).map { + projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") + } + ) - binaries { - getTest("DEBUG").apply { - linkerOpts(nativeFrameworkPaths.map { "-F$it" }) - linkerOpts("-ObjC") + binaries { + getTest("DEBUG").apply { + linkerOpts(nativeFrameworkPaths.map { "-F$it" }) + linkerOpts("-ObjC") + } } - } - compilations.getByName("main") { - cinterops.create("FirebaseCore") { - compilerOpts(nativeFrameworkPaths.map { "-F$it" }) - extraOpts("-verbose") + compilations.getByName("main") { + cinterops.create("FirebaseCore") { + compilerOpts(nativeFrameworkPaths.map { "-F$it" }) + extraOpts("-verbose") + } } } - } - ios(configure = nativeTargetConfig()) - iosSimulatorArm64(configure = nativeTargetConfig()) + ios(configure = nativeTargetConfig()) + iosSimulatorArm64(configure = nativeTargetConfig()) + } js { useCommonJs() @@ -133,13 +139,17 @@ kotlin { } } - val iosMain by getting - val iosSimulatorArm64Main by getting - iosSimulatorArm64Main.dependsOn(iosMain) + if (supportIosTarget) { + val iosMain by getting + val iosSimulatorArm64Main by getting + iosSimulatorArm64Main.dependsOn(iosMain) - val iosTest by sourceSets.getting - val iosSimulatorArm64Test by sourceSets.getting - iosSimulatorArm64Test.dependsOn(iosTest) + if (runIosTests) { + val iosTest by sourceSets.getting + val iosSimulatorArm64Test by sourceSets.getting + iosSimulatorArm64Test.dependsOn(iosTest) + } + } val jsMain by getting } diff --git a/firebase-auth/build.gradle.kts b/firebase-auth/build.gradle.kts index 54cb61fc2..84bd030e2 100644 --- a/firebase-auth/build.gradle.kts +++ b/firebase-auth/build.gradle.kts @@ -80,49 +80,55 @@ kotlin { publishAllLibraryVariants() } - fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { - val nativeFrameworkPaths = listOf( - rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/iOS") - ).plus( - listOf( - "FirebaseAnalytics", - "FirebaseCore", - "FirebaseCoreDiagnostics", - "FirebaseInstallations", - "GoogleAppMeasurement", - "GoogleDataTransport", - "GoogleUtilities", - "nanopb", - "PromisesObjC" - ).map { - rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") - } - ).plus( - listOf( - "FirebaseAuth", - "GTMSessionFetcher" - ).map { - projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") - } - ) + val supportIosTarget = project.property("skipIosTarget") != "true" + val runIosTests = project.property("skipIosTests") != "true" + + if (supportIosTarget) { + + fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { + val nativeFrameworkPaths = listOf( + rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/iOS") + ).plus( + listOf( + "FirebaseAnalytics", + "FirebaseCore", + "FirebaseCoreDiagnostics", + "FirebaseInstallations", + "GoogleAppMeasurement", + "GoogleDataTransport", + "GoogleUtilities", + "nanopb", + "PromisesObjC" + ).map { + rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") + } + ).plus( + listOf( + "FirebaseAuth", + "GTMSessionFetcher" + ).map { + projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") + } + ) - binaries { - getTest("DEBUG").apply { - linkerOpts(nativeFrameworkPaths.map { "-F$it" }) - linkerOpts("-ObjC") + binaries { + getTest("DEBUG").apply { + linkerOpts(nativeFrameworkPaths.map { "-F$it" }) + linkerOpts("-ObjC") + } } - } - compilations.getByName("main") { - cinterops.create("FirebaseAuth") { - compilerOpts(nativeFrameworkPaths.map { "-F$it" }) - extraOpts("-verbose") + compilations.getByName("main") { + cinterops.create("FirebaseAuth") { + compilerOpts(nativeFrameworkPaths.map { "-F$it" }) + extraOpts("-verbose") + } } } - } - ios(configure = nativeTargetConfig()) - iosSimulatorArm64(configure = nativeTargetConfig()) + ios(configure = nativeTargetConfig()) + iosSimulatorArm64(configure = nativeTargetConfig()) + } js { useCommonJs() @@ -165,13 +171,17 @@ kotlin { } } - val iosMain by getting - val iosSimulatorArm64Main by getting - iosSimulatorArm64Main.dependsOn(iosMain) + if (supportIosTarget) { + val iosMain by getting + val iosSimulatorArm64Main by getting + iosSimulatorArm64Main.dependsOn(iosMain) - val iosTest by sourceSets.getting - val iosSimulatorArm64Test by sourceSets.getting - iosSimulatorArm64Test.dependsOn(iosTest) + if (runIosTests) { + val iosTest by sourceSets.getting + val iosSimulatorArm64Test by sourceSets.getting + iosSimulatorArm64Test.dependsOn(iosTest) + } + } val jsMain by getting } diff --git a/firebase-common/build.gradle.kts b/firebase-common/build.gradle.kts index ee32e66bb..2a397f07e 100644 --- a/firebase-common/build.gradle.kts +++ b/firebase-common/build.gradle.kts @@ -46,8 +46,13 @@ kotlin { publishAllLibraryVariants() } - ios() - iosSimulatorArm64() + val supportIosTarget = project.property("skipIosTarget") != "true" + val runIosTests = project.property("skipIosTests") != "true" + + if (supportIosTarget) { + ios() + iosSimulatorArm64() + } js { useCommonJs() @@ -92,13 +97,17 @@ kotlin { } } - val iosMain by getting - val iosSimulatorArm64Main by getting - iosSimulatorArm64Main.dependsOn(iosMain) + if (supportIosTarget) { + val iosMain by getting + val iosSimulatorArm64Main by getting + iosSimulatorArm64Main.dependsOn(iosMain) - val iosTest by sourceSets.getting - val iosSimulatorArm64Test by sourceSets.getting - iosSimulatorArm64Test.dependsOn(iosTest) + if (runIosTests) { + val iosTest by sourceSets.getting + val iosSimulatorArm64Test by sourceSets.getting + iosSimulatorArm64Test.dependsOn(iosTest) + } + } val jsMain by getting { dependencies { diff --git a/firebase-config/build.gradle.kts b/firebase-config/build.gradle.kts index fe19b5aa3..5fdae7342 100644 --- a/firebase-config/build.gradle.kts +++ b/firebase-config/build.gradle.kts @@ -69,45 +69,50 @@ kotlin { publishAllLibraryVariants() } - fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { - val nativeFrameworkPaths = listOf( - "FirebaseCore", - "FirebaseCoreDiagnostics", - "FirebaseAnalytics", - "GoogleAppMeasurement", - "FirebaseInstallations", - "GoogleDataTransport", - "GoogleUtilities", - "PromisesObjC", - "nanopb" - ).map { - rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") - }.plus( - listOf( - "FirebaseABTesting", - "FirebaseRemoteConfig" + val supportIosTarget = project.property("skipIosTarget") != "true" + val runIosTests = project.property("skipIosTests") != "true" + + if (supportIosTarget) { + fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { + val nativeFrameworkPaths = listOf( + "FirebaseCore", + "FirebaseCoreDiagnostics", + "FirebaseAnalytics", + "GoogleAppMeasurement", + "FirebaseInstallations", + "GoogleDataTransport", + "GoogleUtilities", + "PromisesObjC", + "nanopb" ).map { - projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") - } - ) + rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") + }.plus( + listOf( + "FirebaseABTesting", + "FirebaseRemoteConfig" + ).map { + projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") + } + ) - binaries { - getTest("DEBUG").apply { - linkerOpts(nativeFrameworkPaths.map { "-F$it" }) - linkerOpts("-ObjC") + binaries { + getTest("DEBUG").apply { + linkerOpts(nativeFrameworkPaths.map { "-F$it" }) + linkerOpts("-ObjC") + } } - } - compilations.getByName("main") { - cinterops.create("FirebaseRemoteConfig") { - compilerOpts(nativeFrameworkPaths.map { "-F$it" }) - extraOpts("-verbose") + compilations.getByName("main") { + cinterops.create("FirebaseRemoteConfig") { + compilerOpts(nativeFrameworkPaths.map { "-F$it" }) + extraOpts("-verbose") + } } } - } - ios(configure = nativeTargetConfig()) - iosSimulatorArm64(configure = nativeTargetConfig()) + ios(configure = nativeTargetConfig()) + iosSimulatorArm64(configure = nativeTargetConfig()) + } js { useCommonJs() @@ -143,13 +148,17 @@ kotlin { } } - val iosMain by getting - val iosSimulatorArm64Main by getting - iosSimulatorArm64Main.dependsOn(iosMain) + if (supportIosTarget) { + val iosMain by getting + val iosSimulatorArm64Main by getting + iosSimulatorArm64Main.dependsOn(iosMain) - val iosTest by sourceSets.getting - val iosSimulatorArm64Test by sourceSets.getting - iosSimulatorArm64Test.dependsOn(iosTest) + if (runIosTests) { + val iosTest by sourceSets.getting + val iosSimulatorArm64Test by sourceSets.getting + iosSimulatorArm64Test.dependsOn(iosTest) + } + } val jsMain by getting } diff --git a/firebase-database/build.gradle.kts b/firebase-database/build.gradle.kts index 352c3b304..ab1c2ecdc 100644 --- a/firebase-database/build.gradle.kts +++ b/firebase-database/build.gradle.kts @@ -56,49 +56,54 @@ kotlin { publishAllLibraryVariants() } - fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { - val nativeFrameworkPaths = listOf( - rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/iOS") - ).plus( - listOf( - "FirebaseAnalytics", - "FirebaseCore", - "FirebaseCoreDiagnostics", - "FirebaseInstallations", - "GoogleAppMeasurement", - "GoogleDataTransport", - "GoogleUtilities", - "nanopb", - "PromisesObjC" - ).map { - rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") - } - ).plus( - listOf( - "FirebaseDatabase", - "leveldb-library" - ).map { - projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") - } - ) + val supportIosTarget = project.property("skipIosTarget") != "true" + val runIosTests = project.property("skipIosTests") != "true" + + if (supportIosTarget) { + fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { + val nativeFrameworkPaths = listOf( + rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/iOS") + ).plus( + listOf( + "FirebaseAnalytics", + "FirebaseCore", + "FirebaseCoreDiagnostics", + "FirebaseInstallations", + "GoogleAppMeasurement", + "GoogleDataTransport", + "GoogleUtilities", + "nanopb", + "PromisesObjC" + ).map { + rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") + } + ).plus( + listOf( + "FirebaseDatabase", + "leveldb-library" + ).map { + projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") + } + ) - binaries { - getTest("DEBUG").apply { - linkerOpts(nativeFrameworkPaths.map { "-F$it" }) - linkerOpts("-ObjC") + binaries { + getTest("DEBUG").apply { + linkerOpts(nativeFrameworkPaths.map { "-F$it" }) + linkerOpts("-ObjC") + } } - } - compilations.getByName("main") { - cinterops.create("FirebaseDatabase") { - compilerOpts(nativeFrameworkPaths.map { "-F$it" }) - extraOpts("-verbose") + compilations.getByName("main") { + cinterops.create("FirebaseDatabase") { + compilerOpts(nativeFrameworkPaths.map { "-F$it" }) + extraOpts("-verbose") + } } } - } - ios(configure = nativeTargetConfig()) - iosSimulatorArm64(configure = nativeTargetConfig()) + ios(configure = nativeTargetConfig()) + iosSimulatorArm64(configure = nativeTargetConfig()) + } js { useCommonJs() @@ -143,13 +148,17 @@ kotlin { } } - val iosMain by getting - val iosSimulatorArm64Main by getting - iosSimulatorArm64Main.dependsOn(iosMain) + if (supportIosTarget) { + val iosMain by getting + val iosSimulatorArm64Main by getting + iosSimulatorArm64Main.dependsOn(iosMain) - val iosTest by sourceSets.getting - val iosSimulatorArm64Test by sourceSets.getting - iosSimulatorArm64Test.dependsOn(iosTest) + if (runIosTests) { + val iosTest by sourceSets.getting + val iosSimulatorArm64Test by sourceSets.getting + iosSimulatorArm64Test.dependsOn(iosTest) + } + } val jsMain by getting } diff --git a/firebase-firestore/build.gradle.kts b/firebase-firestore/build.gradle.kts index b3a2e30f2..60821fe64 100644 --- a/firebase-firestore/build.gradle.kts +++ b/firebase-firestore/build.gradle.kts @@ -59,53 +59,58 @@ kotlin { publishAllLibraryVariants() } - fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { - val nativeFrameworkPaths = listOf( - rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/iOS") - ).plus( - listOf( - "FirebaseAnalytics", - "FirebaseCore", - "FirebaseCoreDiagnostics", - "FirebaseInstallations", - "GoogleAppMeasurement", - "GoogleDataTransport", - "GoogleUtilities", - "nanopb", - "PromisesObjC" - ).map { - rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") - } - ).plus( - listOf( - "abseil", - "BoringSSL-GRPC", - "FirebaseFirestore", - "gRPC-Core", - "gRPC-C++", - "leveldb-library" - ).map { - projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") - } - ) + val supportIosTarget = project.property("skipIosTarget") != "true" + val runIosTests = project.property("skipIosTests") != "true" + + if (supportIosTarget) { + fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { + val nativeFrameworkPaths = listOf( + rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/iOS") + ).plus( + listOf( + "FirebaseAnalytics", + "FirebaseCore", + "FirebaseCoreDiagnostics", + "FirebaseInstallations", + "GoogleAppMeasurement", + "GoogleDataTransport", + "GoogleUtilities", + "nanopb", + "PromisesObjC" + ).map { + rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") + } + ).plus( + listOf( + "abseil", + "BoringSSL-GRPC", + "FirebaseFirestore", + "gRPC-Core", + "gRPC-C++", + "leveldb-library" + ).map { + projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") + } + ) - binaries { - getTest("DEBUG").apply { - linkerOpts(nativeFrameworkPaths.map { "-F$it" }) - linkerOpts("-ObjC") + binaries { + getTest("DEBUG").apply { + linkerOpts(nativeFrameworkPaths.map { "-F$it" }) + linkerOpts("-ObjC") + } } - } - compilations.getByName("main") { - cinterops.create("FirebaseFirestore") { - compilerOpts(nativeFrameworkPaths.map { "-F$it" }) - extraOpts("-verbose") + compilations.getByName("main") { + cinterops.create("FirebaseFirestore") { + compilerOpts(nativeFrameworkPaths.map { "-F$it" }) + extraOpts("-verbose") + } } } - } - ios(configure = nativeTargetConfig()) - iosSimulatorArm64(configure = nativeTargetConfig()) + ios(configure = nativeTargetConfig()) + iosSimulatorArm64(configure = nativeTargetConfig()) + } js { useCommonJs() @@ -149,13 +154,17 @@ kotlin { } } - val iosMain by getting - val iosSimulatorArm64Main by getting - iosSimulatorArm64Main.dependsOn(iosMain) + if (supportIosTarget) { + val iosMain by getting + val iosSimulatorArm64Main by getting + iosSimulatorArm64Main.dependsOn(iosMain) - val iosTest by sourceSets.getting - val iosSimulatorArm64Test by sourceSets.getting - iosSimulatorArm64Test.dependsOn(iosTest) + if (runIosTests) { + val iosTest by sourceSets.getting + val iosSimulatorArm64Test by sourceSets.getting + iosSimulatorArm64Test.dependsOn(iosTest) + } + } val jsMain by getting } diff --git a/firebase-functions/build.gradle.kts b/firebase-functions/build.gradle.kts index efcb5016d..de83b889f 100644 --- a/firebase-functions/build.gradle.kts +++ b/firebase-functions/build.gradle.kts @@ -51,49 +51,54 @@ kotlin { publishAllLibraryVariants() } - fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { - val nativeFrameworkPaths = listOf( - rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/iOS") - ).plus( - listOf( - "FirebaseAnalytics", - "FirebaseCore", - "FirebaseCoreDiagnostics", - "FirebaseInstallations", - "GoogleAppMeasurement", - "GoogleDataTransport", - "GoogleUtilities", - "nanopb", - "PromisesObjC" - ).map { - rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") - } - ).plus( - listOf( - "FirebaseFunctions", - "GTMSessionFetcher" - ).map { - projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") - } - ) + val supportIosTarget = project.property("skipIosTarget") != "true" + val runIosTests = project.property("skipIosTests") != "true" + + if (supportIosTarget) { + fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { + val nativeFrameworkPaths = listOf( + rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/iOS") + ).plus( + listOf( + "FirebaseAnalytics", + "FirebaseCore", + "FirebaseCoreDiagnostics", + "FirebaseInstallations", + "GoogleAppMeasurement", + "GoogleDataTransport", + "GoogleUtilities", + "nanopb", + "PromisesObjC" + ).map { + rootProject.project("firebase-app").projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") + } + ).plus( + listOf( + "FirebaseFunctions", + "GTMSessionFetcher" + ).map { + projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") + } + ) - binaries { - getTest("DEBUG").apply { - linkerOpts(nativeFrameworkPaths.map { "-F$it" }) - linkerOpts("-ObjC") + binaries { + getTest("DEBUG").apply { + linkerOpts(nativeFrameworkPaths.map { "-F$it" }) + linkerOpts("-ObjC") + } } - } - compilations.getByName("main") { - cinterops.create("FirebaseFunctions") { - compilerOpts(nativeFrameworkPaths.map { "-F$it" }) - extraOpts("-verbose") + compilations.getByName("main") { + cinterops.create("FirebaseFunctions") { + compilerOpts(nativeFrameworkPaths.map { "-F$it" }) + extraOpts("-verbose") + } } } - } - ios(configure = nativeTargetConfig()) - iosSimulatorArm64(configure = nativeTargetConfig()) + ios(configure = nativeTargetConfig()) + iosSimulatorArm64(configure = nativeTargetConfig()) + } js { useCommonJs() @@ -137,13 +142,17 @@ kotlin { } } - val iosMain by getting - val iosSimulatorArm64Main by getting - iosSimulatorArm64Main.dependsOn(iosMain) + if (supportIosTarget) { + val iosMain by getting + val iosSimulatorArm64Main by getting + iosSimulatorArm64Main.dependsOn(iosMain) - val iosTest by sourceSets.getting - val iosSimulatorArm64Test by sourceSets.getting - iosSimulatorArm64Test.dependsOn(iosTest) + if (runIosTests) { + val iosTest by sourceSets.getting + val iosSimulatorArm64Test by sourceSets.getting + iosSimulatorArm64Test.dependsOn(iosTest) + } + } val jsMain by getting } diff --git a/gradle.properties b/gradle.properties index 4d4351bea..4bde6e53c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,6 +17,9 @@ org.gradle.parallel=true systemProp.org.gradle.internal.publish.checksums.insecure=true testOptions.unitTests.isIncludeAndroidResources=true +skipIosTarget=false +skipIosTests=false + # Versions: firebase-app.version=1.4.2 firebase-auth.version=1.4.2 From 54284f9d78dc8bfac64fee49d039a574b135aa95 Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Mon, 4 Oct 2021 16:52:52 +0100 Subject: [PATCH 02/19] Adjusted tests to not use skip variable. Added granular ios test skip --- firebase-app/build.gradle.kts | 2 +- .../kotlin/dev/gitlive/firebase/auth/auth.kt | 20 +++++++------------ .../kotlin/dev/gitlive/firebase/auth/auth.kt | 9 +-------- .../kotlin/dev/gitlive/firebase/auth/auth.kt | 9 +-------- firebase-common/build.gradle.kts | 2 +- firebase-config/build.gradle.kts | 2 +- firebase-database/build.gradle.kts | 2 +- firebase-firestore/build.gradle.kts | 2 +- firebase-functions/build.gradle.kts | 2 +- gradle.properties | 10 +++++++++- 10 files changed, 24 insertions(+), 36 deletions(-) diff --git a/firebase-app/build.gradle.kts b/firebase-app/build.gradle.kts index 45cafc56a..b541b318c 100644 --- a/firebase-app/build.gradle.kts +++ b/firebase-app/build.gradle.kts @@ -58,7 +58,7 @@ kotlin { } val supportIosTarget = project.property("skipIosTarget") != "true" - val runIosTests = project.property("skipIosTests") != "true" + val runIosTests = project.property("firebase-app.skipIosTests") != "true" if (supportIosTarget) { diff --git a/firebase-auth/src/commonTest/kotlin/dev/gitlive/firebase/auth/auth.kt b/firebase-auth/src/commonTest/kotlin/dev/gitlive/firebase/auth/auth.kt index 2fe59c4c6..d4accec09 100644 --- a/firebase-auth/src/commonTest/kotlin/dev/gitlive/firebase/auth/auth.kt +++ b/firebase-auth/src/commonTest/kotlin/dev/gitlive/firebase/auth/auth.kt @@ -10,16 +10,10 @@ import kotlin.test.* expect val emulatorHost: String expect val context: Any -expect fun runTest(skip: Boolean = false, test: suspend () -> Unit) -expect val currentPlatform: Platform - -enum class Platform { Android, IOS, JS } +expect fun runTest(test: suspend () -> Unit) class FirebaseAuthTest { - // Skip the tests on iOS simulator due keychain exceptions - private val skip = currentPlatform == Platform.IOS - @BeforeTest fun initializeFirebase() { Firebase @@ -41,14 +35,14 @@ class FirebaseAuthTest { } @Test - fun testSignInWithUsernameAndPassword() = runTest(skip) { + fun testSignInWithUsernameAndPassword() = runTest { val uid = getTestUid("test@test.com", "test123") val result = Firebase.auth.signInWithEmailAndPassword("test@test.com", "test123") assertEquals(uid, result.user!!.uid) } @Test - fun testCreateUserWithEmailAndPassword() = runTest(skip) { + fun testCreateUserWithEmailAndPassword() = runTest { val email = "test+${Random.nextInt(100000)}@test.com" val createResult = Firebase.auth.createUserWithEmailAndPassword(email, "test123") assertNotEquals(null, createResult.user?.uid) @@ -63,7 +57,7 @@ class FirebaseAuthTest { } @Test - fun testFetchSignInMethods() = runTest(skip) { + fun testFetchSignInMethods() = runTest { val email = "test+${Random.nextInt(100000)}@test.com" var signInMethodResult = Firebase.auth.fetchSignInMethodsForEmail(email) assertEquals(emptyList(), signInMethodResult) @@ -75,7 +69,7 @@ class FirebaseAuthTest { } @Test - fun testSendEmailVerification() = runTest(skip) { + fun testSendEmailVerification() = runTest { val email = "test+${Random.nextInt(100000)}@test.com" val createResult = Firebase.auth.createUserWithEmailAndPassword(email, "test123") assertNotEquals(null, createResult.user?.uid) @@ -85,7 +79,7 @@ class FirebaseAuthTest { } @Test - fun sendPasswordResetEmail() = runTest(skip) { + fun sendPasswordResetEmail() = runTest { val email = "test+${Random.nextInt(100000)}@test.com" val createResult = Firebase.auth.createUserWithEmailAndPassword(email, "test123") assertNotEquals(null, createResult.user?.uid) @@ -96,7 +90,7 @@ class FirebaseAuthTest { } @Test - fun testSignInWithCredential() = runTest(skip) { + fun testSignInWithCredential() = runTest { val uid = getTestUid("test@test.com", "test123") val credential = EmailAuthProvider.credential("test@test.com", "test123") val result = Firebase.auth.signInWithCredential(credential) diff --git a/firebase-auth/src/iosTest/kotlin/dev/gitlive/firebase/auth/auth.kt b/firebase-auth/src/iosTest/kotlin/dev/gitlive/firebase/auth/auth.kt index bd72b1dbe..540531237 100644 --- a/firebase-auth/src/iosTest/kotlin/dev/gitlive/firebase/auth/auth.kt +++ b/firebase-auth/src/iosTest/kotlin/dev/gitlive/firebase/auth/auth.kt @@ -11,14 +11,7 @@ actual val emulatorHost: String = "localhost" actual val context: Any = Unit -actual val currentPlatform: Platform = Platform.IOS - -actual fun runTest(skip: Boolean, test: suspend () -> Unit) = runBlocking { - if (skip) { - NSLog("Skip the test.") - return@runBlocking - } - +actual fun runTest(test: suspend () -> Unit) = runBlocking { val testRun = MainScope().async { test() } while (testRun.isActive) { NSRunLoop.mainRunLoop.runMode( diff --git a/firebase-auth/src/jsTest/kotlin/dev/gitlive/firebase/auth/auth.kt b/firebase-auth/src/jsTest/kotlin/dev/gitlive/firebase/auth/auth.kt index 93fb3effa..340f1fa6c 100644 --- a/firebase-auth/src/jsTest/kotlin/dev/gitlive/firebase/auth/auth.kt +++ b/firebase-auth/src/jsTest/kotlin/dev/gitlive/firebase/auth/auth.kt @@ -11,15 +11,8 @@ actual val emulatorHost: String = "localhost" actual val context: Any = Unit -actual val currentPlatform: Platform = Platform.JS - -actual fun runTest(skip: Boolean, test: suspend () -> Unit) = GlobalScope +actual fun runTest(test: suspend () -> Unit) = GlobalScope .promise { - if (skip) { - console.log("Skip the test.") - return@promise - } - try { test() } catch (e: dynamic) { diff --git a/firebase-common/build.gradle.kts b/firebase-common/build.gradle.kts index 2a397f07e..32a85cda8 100644 --- a/firebase-common/build.gradle.kts +++ b/firebase-common/build.gradle.kts @@ -47,7 +47,7 @@ kotlin { } val supportIosTarget = project.property("skipIosTarget") != "true" - val runIosTests = project.property("skipIosTests") != "true" + val runIosTests = project.property("firebase-common.skipIosTests") != "true" if (supportIosTarget) { ios() diff --git a/firebase-config/build.gradle.kts b/firebase-config/build.gradle.kts index 5fdae7342..a74f87f27 100644 --- a/firebase-config/build.gradle.kts +++ b/firebase-config/build.gradle.kts @@ -70,7 +70,7 @@ kotlin { } val supportIosTarget = project.property("skipIosTarget") != "true" - val runIosTests = project.property("skipIosTests") != "true" + val runIosTests = project.property("firebase-config.skipIosTests") != "true" if (supportIosTarget) { fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { diff --git a/firebase-database/build.gradle.kts b/firebase-database/build.gradle.kts index ab1c2ecdc..ba9968494 100644 --- a/firebase-database/build.gradle.kts +++ b/firebase-database/build.gradle.kts @@ -57,7 +57,7 @@ kotlin { } val supportIosTarget = project.property("skipIosTarget") != "true" - val runIosTests = project.property("skipIosTests") != "true" + val runIosTests = project.property("firebase-database.skipIosTests") != "true" if (supportIosTarget) { fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { diff --git a/firebase-firestore/build.gradle.kts b/firebase-firestore/build.gradle.kts index 60821fe64..adb84e344 100644 --- a/firebase-firestore/build.gradle.kts +++ b/firebase-firestore/build.gradle.kts @@ -60,7 +60,7 @@ kotlin { } val supportIosTarget = project.property("skipIosTarget") != "true" - val runIosTests = project.property("skipIosTests") != "true" + val runIosTests = project.property("firebase-firestore.skipIosTests") != "true" if (supportIosTarget) { fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { diff --git a/firebase-functions/build.gradle.kts b/firebase-functions/build.gradle.kts index de83b889f..f442527e2 100644 --- a/firebase-functions/build.gradle.kts +++ b/firebase-functions/build.gradle.kts @@ -52,7 +52,7 @@ kotlin { } val supportIosTarget = project.property("skipIosTarget") != "true" - val runIosTests = project.property("skipIosTests") != "true" + val runIosTests = project.property("firebase-functions.skipIosTests") != "true" if (supportIosTarget) { fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { diff --git a/gradle.properties b/gradle.properties index 4bde6e53c..b0f312e4f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,8 +17,16 @@ org.gradle.parallel=true systemProp.org.gradle.internal.publish.checksums.insecure=true testOptions.unitTests.isIncludeAndroidResources=true +# Set to true to skip tests and even compilation of the iOS target. skipIosTarget=false -skipIosTests=false +# Skip iOS Tests +firebase-app.skipIosTests=false +firebase-auth.skipIosTests=false +firebase-common.skipIosTests=false +firebase-database.skipIosTests=false +firebase-firestore.skipIosTests=false +firebase-functions.skipIosTests=false +firebase-config.skipIosTests=false # Versions: firebase-app.version=1.4.2 From 2aa9f0d2383b68eca5fbe5872671174a1ef50d82 Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Mon, 4 Oct 2021 17:00:59 +0100 Subject: [PATCH 03/19] Added missing property. Added skip for ios tests in auth target. --- firebase-auth/build.gradle.kts | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/firebase-auth/build.gradle.kts b/firebase-auth/build.gradle.kts index 84bd030e2..834d2154d 100644 --- a/firebase-auth/build.gradle.kts +++ b/firebase-auth/build.gradle.kts @@ -81,7 +81,7 @@ kotlin { } val supportIosTarget = project.property("skipIosTarget") != "true" - val runIosTests = project.property("skipIosTests") != "true" + val runIosTests = project.property("firebase-auth.skipIosTests") != "true" if (supportIosTarget) { diff --git a/gradle.properties b/gradle.properties index b0f312e4f..94533b4d7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,7 +21,7 @@ testOptions.unitTests.isIncludeAndroidResources=true skipIosTarget=false # Skip iOS Tests firebase-app.skipIosTests=false -firebase-auth.skipIosTests=false +firebase-auth.skipIosTests=true firebase-common.skipIosTests=false firebase-database.skipIosTests=false firebase-firestore.skipIosTests=false From 3a17171acd68368a8bc6a7a9a86fbc70fc233a76 Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Mon, 4 Oct 2021 17:35:45 +0100 Subject: [PATCH 04/19] added logging --- firebase-auth/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/firebase-auth/build.gradle.kts b/firebase-auth/build.gradle.kts index 834d2154d..dfc0123ec 100644 --- a/firebase-auth/build.gradle.kts +++ b/firebase-auth/build.gradle.kts @@ -83,6 +83,7 @@ kotlin { val supportIosTarget = project.property("skipIosTarget") != "true" val runIosTests = project.property("firebase-auth.skipIosTests") != "true" + println("supportIosTarget: $supportIosTarget runIosTests $runIosTests") if (supportIosTarget) { fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { From 2d603e771020f0651b85876645e61eb1afd4ed6d Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Mon, 4 Oct 2021 18:40:53 +0100 Subject: [PATCH 05/19] Added different approach to cancel ios tests --- firebase-auth/build.gradle.kts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/firebase-auth/build.gradle.kts b/firebase-auth/build.gradle.kts index dfc0123ec..ec7123aec 100644 --- a/firebase-auth/build.gradle.kts +++ b/firebase-auth/build.gradle.kts @@ -111,7 +111,6 @@ kotlin { projectDir.resolve("src/nativeInterop/cinterop/Carthage/Build/$it.xcframework/${konanTarget.archVariant}") } ) - binaries { getTest("DEBUG").apply { linkerOpts(nativeFrameworkPaths.map { "-F$it" }) @@ -186,6 +185,14 @@ kotlin { val jsMain by getting } + + if (!runIosTests) { + tasks.forEach { + if (it.name.contains("ios") && it.name.contains("test")) { + it.onlyIf { false } + } + } + } } signing { From 161289707004e58c90f292080be43b6d47a72c98 Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Tue, 5 Oct 2021 08:04:21 +0100 Subject: [PATCH 06/19] Disable test tasks in gradle to skip ios tests --- firebase-auth/build.gradle.kts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/firebase-auth/build.gradle.kts b/firebase-auth/build.gradle.kts index ec7123aec..3f1a6a6e6 100644 --- a/firebase-auth/build.gradle.kts +++ b/firebase-auth/build.gradle.kts @@ -176,11 +176,9 @@ kotlin { val iosSimulatorArm64Main by getting iosSimulatorArm64Main.dependsOn(iosMain) - if (runIosTests) { - val iosTest by sourceSets.getting - val iosSimulatorArm64Test by sourceSets.getting - iosSimulatorArm64Test.dependsOn(iosTest) - } + val iosTest by sourceSets.getting + val iosSimulatorArm64Test by sourceSets.getting + iosSimulatorArm64Test.dependsOn(iosTest) } val jsMain by getting @@ -188,9 +186,7 @@ kotlin { if (!runIosTests) { tasks.forEach { - if (it.name.contains("ios") && it.name.contains("test")) { - it.onlyIf { false } - } + if (it.name.contains("ios") && it.name.contains("test")) { it.enabled = false } } } } From f05089638667aa5e524cb15ef929ce7eacf55cc5 Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Tue, 5 Oct 2021 08:25:14 +0100 Subject: [PATCH 07/19] Disable test tasks in gradle to skip ios tests --- firebase-auth/build.gradle.kts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/firebase-auth/build.gradle.kts b/firebase-auth/build.gradle.kts index 3f1a6a6e6..dca9edf73 100644 --- a/firebase-auth/build.gradle.kts +++ b/firebase-auth/build.gradle.kts @@ -81,9 +81,6 @@ kotlin { } val supportIosTarget = project.property("skipIosTarget") != "true" - val runIosTests = project.property("firebase-auth.skipIosTests") != "true" - - println("supportIosTarget: $supportIosTarget runIosTests $runIosTests") if (supportIosTarget) { fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { @@ -183,10 +180,13 @@ kotlin { val jsMain by getting } +} - if (!runIosTests) { - tasks.forEach { - if (it.name.contains("ios") && it.name.contains("test")) { it.enabled = false } +if (project.property("firebase-auth.skipIosTests") == "true") { + tasks.forEach { + if (it.name.contains("ios") && it.name.contains("test")) { + println("Skipping ${it.name}") + it.enabled = false } } } From 81a3c2bed36416a42c52e2475a30354c4bddeab9 Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Tue, 5 Oct 2021 08:47:46 +0100 Subject: [PATCH 08/19] Moved skip test to the outer scope of a project. --- firebase-app/build.gradle.kts | 16 +++++++++------- firebase-common/build.gradle.kts | 15 +++++++++------ firebase-config/build.gradle.kts | 16 +++++++++------- firebase-database/build.gradle.kts | 16 +++++++++------- firebase-firestore/build.gradle.kts | 17 ++++++++++------- firebase-functions/build.gradle.kts | 16 +++++++++------- 6 files changed, 55 insertions(+), 41 deletions(-) diff --git a/firebase-app/build.gradle.kts b/firebase-app/build.gradle.kts index b541b318c..b972a06e6 100644 --- a/firebase-app/build.gradle.kts +++ b/firebase-app/build.gradle.kts @@ -58,8 +58,6 @@ kotlin { } val supportIosTarget = project.property("skipIosTarget") != "true" - val runIosTests = project.property("firebase-app.skipIosTests") != "true" - if (supportIosTarget) { fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { @@ -144,17 +142,21 @@ kotlin { val iosSimulatorArm64Main by getting iosSimulatorArm64Main.dependsOn(iosMain) - if (runIosTests) { - val iosTest by sourceSets.getting - val iosSimulatorArm64Test by sourceSets.getting - iosSimulatorArm64Test.dependsOn(iosTest) - } + val iosTest by sourceSets.getting + val iosSimulatorArm64Test by sourceSets.getting + iosSimulatorArm64Test.dependsOn(iosTest) } val jsMain by getting } } +if (project.property("firebase-app.skipIosTests") == "true") { + tasks.forEach { + if (it.name.contains("ios") && it.name.contains("test")) { it.enabled = false } + } +} + signing { val signingKey: String? by project val signingPassword: String? by project diff --git a/firebase-common/build.gradle.kts b/firebase-common/build.gradle.kts index 32a85cda8..0052ee881 100644 --- a/firebase-common/build.gradle.kts +++ b/firebase-common/build.gradle.kts @@ -47,7 +47,6 @@ kotlin { } val supportIosTarget = project.property("skipIosTarget") != "true" - val runIosTests = project.property("firebase-common.skipIosTests") != "true" if (supportIosTarget) { ios() @@ -102,11 +101,9 @@ kotlin { val iosSimulatorArm64Main by getting iosSimulatorArm64Main.dependsOn(iosMain) - if (runIosTests) { - val iosTest by sourceSets.getting - val iosSimulatorArm64Test by sourceSets.getting - iosSimulatorArm64Test.dependsOn(iosTest) - } + val iosTest by sourceSets.getting + val iosSimulatorArm64Test by sourceSets.getting + iosSimulatorArm64Test.dependsOn(iosTest) } val jsMain by getting { @@ -117,6 +114,12 @@ kotlin { } } +if (project.property("firebase-common.skipIosTests") == "true") { + tasks.forEach { + if (it.name.contains("ios") && it.name.contains("test")) { it.enabled = false } + } +} + signing { val signingKey: String? by project val signingPassword: String? by project diff --git a/firebase-config/build.gradle.kts b/firebase-config/build.gradle.kts index a74f87f27..dbf82bf2a 100644 --- a/firebase-config/build.gradle.kts +++ b/firebase-config/build.gradle.kts @@ -70,8 +70,6 @@ kotlin { } val supportIosTarget = project.property("skipIosTarget") != "true" - val runIosTests = project.property("firebase-config.skipIosTests") != "true" - if (supportIosTarget) { fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { val nativeFrameworkPaths = listOf( @@ -153,17 +151,21 @@ kotlin { val iosSimulatorArm64Main by getting iosSimulatorArm64Main.dependsOn(iosMain) - if (runIosTests) { - val iosTest by sourceSets.getting - val iosSimulatorArm64Test by sourceSets.getting - iosSimulatorArm64Test.dependsOn(iosTest) - } + val iosTest by sourceSets.getting + val iosSimulatorArm64Test by sourceSets.getting + iosSimulatorArm64Test.dependsOn(iosTest) } val jsMain by getting } } +if (project.property("firebase-config.skipIosTests") == "true") { + tasks.forEach { + if (it.name.contains("ios") && it.name.contains("test")) { it.enabled = false } + } +} + signing { val signingKey: String? by project val signingPassword: String? by project diff --git a/firebase-database/build.gradle.kts b/firebase-database/build.gradle.kts index ba9968494..f6c2d818f 100644 --- a/firebase-database/build.gradle.kts +++ b/firebase-database/build.gradle.kts @@ -57,8 +57,6 @@ kotlin { } val supportIosTarget = project.property("skipIosTarget") != "true" - val runIosTests = project.property("firebase-database.skipIosTests") != "true" - if (supportIosTarget) { fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { val nativeFrameworkPaths = listOf( @@ -153,17 +151,21 @@ kotlin { val iosSimulatorArm64Main by getting iosSimulatorArm64Main.dependsOn(iosMain) - if (runIosTests) { - val iosTest by sourceSets.getting - val iosSimulatorArm64Test by sourceSets.getting - iosSimulatorArm64Test.dependsOn(iosTest) - } + val iosTest by sourceSets.getting + val iosSimulatorArm64Test by sourceSets.getting + iosSimulatorArm64Test.dependsOn(iosTest) } val jsMain by getting } } +if (project.property("firebase-skipIosTests.skipIosTests") == "true") { + tasks.forEach { + if (it.name.contains("ios") && it.name.contains("test")) { it.enabled = false } + } +} + signing { val signingKey: String? by project val signingPassword: String? by project diff --git a/firebase-firestore/build.gradle.kts b/firebase-firestore/build.gradle.kts index adb84e344..9f977487f 100644 --- a/firebase-firestore/build.gradle.kts +++ b/firebase-firestore/build.gradle.kts @@ -60,8 +60,6 @@ kotlin { } val supportIosTarget = project.property("skipIosTarget") != "true" - val runIosTests = project.property("firebase-firestore.skipIosTests") != "true" - if (supportIosTarget) { fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { val nativeFrameworkPaths = listOf( @@ -159,16 +157,21 @@ kotlin { val iosSimulatorArm64Main by getting iosSimulatorArm64Main.dependsOn(iosMain) - if (runIosTests) { - val iosTest by sourceSets.getting - val iosSimulatorArm64Test by sourceSets.getting - iosSimulatorArm64Test.dependsOn(iosTest) - } + val iosTest by sourceSets.getting + val iosSimulatorArm64Test by sourceSets.getting + iosSimulatorArm64Test.dependsOn(iosTest) } val jsMain by getting } } + +if (project.property("firebase-firestore.skipIosTests") == "true") { + tasks.forEach { + if (it.name.contains("ios") && it.name.contains("test")) { it.enabled = false } + } +} + signing { val signingKey: String? by project val signingPassword: String? by project diff --git a/firebase-functions/build.gradle.kts b/firebase-functions/build.gradle.kts index f442527e2..2b544b89c 100644 --- a/firebase-functions/build.gradle.kts +++ b/firebase-functions/build.gradle.kts @@ -52,8 +52,6 @@ kotlin { } val supportIosTarget = project.property("skipIosTarget") != "true" - val runIosTests = project.property("firebase-functions.skipIosTests") != "true" - if (supportIosTarget) { fun nativeTargetConfig(): KotlinNativeTarget.() -> Unit = { val nativeFrameworkPaths = listOf( @@ -147,17 +145,21 @@ kotlin { val iosSimulatorArm64Main by getting iosSimulatorArm64Main.dependsOn(iosMain) - if (runIosTests) { - val iosTest by sourceSets.getting - val iosSimulatorArm64Test by sourceSets.getting - iosSimulatorArm64Test.dependsOn(iosTest) - } + val iosTest by sourceSets.getting + val iosSimulatorArm64Test by sourceSets.getting + iosSimulatorArm64Test.dependsOn(iosTest) } val jsMain by getting } } +if (project.property("firebase-functions.skipIosTests") == "true") { + tasks.forEach { + if (it.name.contains("ios") && it.name.contains("test")) { it.enabled = false } + } +} + signing { val signingKey: String? by project val signingPassword: String? by project From 14f926e163c6a062e23eb8cdde72032fb235a73b Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Tue, 5 Oct 2021 08:51:27 +0100 Subject: [PATCH 09/19] Added ignore case for task check --- firebase-app/build.gradle.kts | 2 +- firebase-auth/build.gradle.kts | 5 +---- firebase-common/build.gradle.kts | 2 +- firebase-config/build.gradle.kts | 2 +- firebase-database/build.gradle.kts | 2 +- firebase-firestore/build.gradle.kts | 2 +- firebase-functions/build.gradle.kts | 2 +- 7 files changed, 7 insertions(+), 10 deletions(-) diff --git a/firebase-app/build.gradle.kts b/firebase-app/build.gradle.kts index b972a06e6..b55e1ec5e 100644 --- a/firebase-app/build.gradle.kts +++ b/firebase-app/build.gradle.kts @@ -153,7 +153,7 @@ kotlin { if (project.property("firebase-app.skipIosTests") == "true") { tasks.forEach { - if (it.name.contains("ios") && it.name.contains("test")) { it.enabled = false } + if (it.name.contains("ios", true) && it.name.contains("test", true)) { it.enabled = false } } } diff --git a/firebase-auth/build.gradle.kts b/firebase-auth/build.gradle.kts index dca9edf73..f359d3152 100644 --- a/firebase-auth/build.gradle.kts +++ b/firebase-auth/build.gradle.kts @@ -184,10 +184,7 @@ kotlin { if (project.property("firebase-auth.skipIosTests") == "true") { tasks.forEach { - if (it.name.contains("ios") && it.name.contains("test")) { - println("Skipping ${it.name}") - it.enabled = false - } + if (it.name.contains("ios", true) && it.name.contains("test", true)) { it.enabled = false } } } diff --git a/firebase-common/build.gradle.kts b/firebase-common/build.gradle.kts index 0052ee881..c809581df 100644 --- a/firebase-common/build.gradle.kts +++ b/firebase-common/build.gradle.kts @@ -116,7 +116,7 @@ kotlin { if (project.property("firebase-common.skipIosTests") == "true") { tasks.forEach { - if (it.name.contains("ios") && it.name.contains("test")) { it.enabled = false } + if (it.name.contains("ios", true) && it.name.contains("test", true)) { it.enabled = false } } } diff --git a/firebase-config/build.gradle.kts b/firebase-config/build.gradle.kts index dbf82bf2a..6f1bb82c4 100644 --- a/firebase-config/build.gradle.kts +++ b/firebase-config/build.gradle.kts @@ -162,7 +162,7 @@ kotlin { if (project.property("firebase-config.skipIosTests") == "true") { tasks.forEach { - if (it.name.contains("ios") && it.name.contains("test")) { it.enabled = false } + if (it.name.contains("ios", true) && it.name.contains("test", true)) { it.enabled = false } } } diff --git a/firebase-database/build.gradle.kts b/firebase-database/build.gradle.kts index f6c2d818f..380b0a12c 100644 --- a/firebase-database/build.gradle.kts +++ b/firebase-database/build.gradle.kts @@ -162,7 +162,7 @@ kotlin { if (project.property("firebase-skipIosTests.skipIosTests") == "true") { tasks.forEach { - if (it.name.contains("ios") && it.name.contains("test")) { it.enabled = false } + if (it.name.contains("ios", true) && it.name.contains("test", true)) { it.enabled = false } } } diff --git a/firebase-firestore/build.gradle.kts b/firebase-firestore/build.gradle.kts index 9f977487f..44a2a001b 100644 --- a/firebase-firestore/build.gradle.kts +++ b/firebase-firestore/build.gradle.kts @@ -168,7 +168,7 @@ kotlin { if (project.property("firebase-firestore.skipIosTests") == "true") { tasks.forEach { - if (it.name.contains("ios") && it.name.contains("test")) { it.enabled = false } + if (it.name.contains("ios", true) && it.name.contains("test", true)) { it.enabled = false } } } diff --git a/firebase-functions/build.gradle.kts b/firebase-functions/build.gradle.kts index 2b544b89c..d9392dffe 100644 --- a/firebase-functions/build.gradle.kts +++ b/firebase-functions/build.gradle.kts @@ -156,7 +156,7 @@ kotlin { if (project.property("firebase-functions.skipIosTests") == "true") { tasks.forEach { - if (it.name.contains("ios") && it.name.contains("test")) { it.enabled = false } + if (it.name.contains("ios", true) && it.name.contains("test", true)) { it.enabled = false } } } From 2e49afdff4a06038878bed0cb40eac7d4246a681 Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Tue, 5 Oct 2021 09:03:31 +0100 Subject: [PATCH 10/19] fixed typo --- firebase-database/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firebase-database/build.gradle.kts b/firebase-database/build.gradle.kts index 380b0a12c..196209885 100644 --- a/firebase-database/build.gradle.kts +++ b/firebase-database/build.gradle.kts @@ -160,7 +160,7 @@ kotlin { } } -if (project.property("firebase-skipIosTests.skipIosTests") == "true") { +if (project.property("firebase-database.skipIosTests") == "true") { tasks.forEach { if (it.name.contains("ios", true) && it.name.contains("test", true)) { it.enabled = false } } From 879ca6036697fff8c992abfc12c3f0eae143b13e Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Tue, 5 Oct 2021 10:11:12 +0100 Subject: [PATCH 11/19] Added fix for android tests --- .../kotlin/dev/gitlive/firebase/auth/auth.kt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/firebase-auth/src/androidAndroidTest/kotlin/dev/gitlive/firebase/auth/auth.kt b/firebase-auth/src/androidAndroidTest/kotlin/dev/gitlive/firebase/auth/auth.kt index b6495fc34..364e7f381 100644 --- a/firebase-auth/src/androidAndroidTest/kotlin/dev/gitlive/firebase/auth/auth.kt +++ b/firebase-auth/src/androidAndroidTest/kotlin/dev/gitlive/firebase/auth/auth.kt @@ -13,14 +13,7 @@ actual val emulatorHost: String = "10.0.2.2" actual val context: Any = InstrumentationRegistry.getInstrumentation().targetContext -actual val currentPlatform: Platform = Platform.Android - -actual fun runTest(skip: Boolean, test: suspend () -> Unit) = runBlocking { - if (skip) { - Log.w("Test", "Skip the test.") - return@runBlocking - } - +actual fun runTest(test: suspend () -> Unit) = runBlocking { test() } From 8737a7d4fe786132a37cb553685e257b4e92d45a Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Tue, 5 Oct 2021 10:26:54 +0100 Subject: [PATCH 12/19] Adjust workflow for debugging --- .github/workflows/pull_request.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 107872fe7..9d0bf310e 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -4,6 +4,8 @@ name: Pull Request on: + push: + branches: [ GL-855-fix-upload-issue-with-firebase ] pull_request: branches: [ master ] From e3fa77034de9286010f55bfbda319c9c58810467 Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Tue, 5 Oct 2021 10:27:31 +0100 Subject: [PATCH 13/19] bump version --- gradle.properties | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index 94533b4d7..8c04adbb6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -29,10 +29,10 @@ firebase-functions.skipIosTests=false firebase-config.skipIosTests=false # Versions: -firebase-app.version=1.4.2 -firebase-auth.version=1.4.2 -firebase-common.version=1.4.2 -firebase-database.version=1.4.2 -firebase-firestore.version=1.4.2 -firebase-functions.version=1.4.2 -firebase-config.version=1.4.2 +firebase-app.version=1.4.3 +firebase-auth.version=1.4.3 +firebase-common.version=1.4.3 +firebase-database.version=1.4.3 +firebase-firestore.version=1.4.3 +firebase-functions.version=1.4.3 +firebase-config.version=1.4.3 From 7b48bea3df794e3d7bddb1542ff2b3d59c3a1f5e Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Tue, 5 Oct 2021 10:44:27 +0100 Subject: [PATCH 14/19] Adjusted workflow --- .github/workflows/publish.yml | 2 ++ .github/workflows/pull_request.yml | 2 -- firebase-app/package.json | 2 +- firebase-auth/package.json | 2 +- firebase-config/package.json | 2 +- firebase-database/package.json | 2 +- firebase-firestore/package.json | 2 +- firebase-functions/package.json | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e0ae15d91..0f1a25da5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,6 +4,8 @@ name: Publish on: + push: + branches: [ GL-855-fix-upload-issue-with-firebase ] release: types: [prereleased, released] diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 9d0bf310e..107872fe7 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -4,8 +4,6 @@ name: Pull Request on: - push: - branches: [ GL-855-fix-upload-issue-with-firebase ] pull_request: branches: [ master ] diff --git a/firebase-app/package.json b/firebase-app/package.json index 569347617..615a88589 100644 --- a/firebase-app/package.json +++ b/firebase-app/package.json @@ -23,7 +23,7 @@ }, "homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk", "dependencies": { - "@gitlive/firebase-common": "1.4.2", + "@gitlive/firebase-common": "1.4.3", "firebase": "8.10.0", "kotlin": "1.5.30", "kotlinx-coroutines-core": "1.5.2" diff --git a/firebase-auth/package.json b/firebase-auth/package.json index ca07d0f26..7e96fd49d 100644 --- a/firebase-auth/package.json +++ b/firebase-auth/package.json @@ -23,7 +23,7 @@ }, "homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk", "dependencies": { - "@gitlive/firebase-app": "1.4.2", + "@gitlive/firebase-app": "1.4.3", "firebase": "8.10.0", "kotlin": "1.5.30", "kotlinx-coroutines-core": "1.5.2" diff --git a/firebase-config/package.json b/firebase-config/package.json index bf92a5db6..5a496ba6a 100644 --- a/firebase-config/package.json +++ b/firebase-config/package.json @@ -23,7 +23,7 @@ }, "homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk", "dependencies": { - "@gitlive/firebase-app": "1.4.2", + "@gitlive/firebase-app": "1.4.3", "firebase": "8.10.0", "kotlin": "1.5.30", "kotlinx-coroutines-core": "1.5.2" diff --git a/firebase-database/package.json b/firebase-database/package.json index 5ced5cf67..b2fbc615a 100644 --- a/firebase-database/package.json +++ b/firebase-database/package.json @@ -23,7 +23,7 @@ }, "homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk", "dependencies": { - "@gitlive/firebase-app": "1.4.2", + "@gitlive/firebase-app": "1.4.3", "firebase": "8.10.0", "kotlin": "1.5.30", "kotlinx-coroutines-core": "1.5.2" diff --git a/firebase-firestore/package.json b/firebase-firestore/package.json index 5e888d979..677b33af1 100644 --- a/firebase-firestore/package.json +++ b/firebase-firestore/package.json @@ -23,7 +23,7 @@ }, "homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk", "dependencies": { - "@gitlive/firebase-app": "1.4.2", + "@gitlive/firebase-app": "1.4.3", "firebase": "8.10.0", "kotlin": "1.5.30", "kotlinx-coroutines-core": "1.5.2" diff --git a/firebase-functions/package.json b/firebase-functions/package.json index 52318978d..7861d99fa 100644 --- a/firebase-functions/package.json +++ b/firebase-functions/package.json @@ -23,7 +23,7 @@ }, "homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk", "dependencies": { - "@gitlive/firebase-app": "1.4.2", + "@gitlive/firebase-app": "1.4.3", "firebase": "8.10.0", "kotlin": "1.5.30", "kotlinx-coroutines-core": "1.5.2" From e31ae19991516c0b022822d222adfe6d466595f9 Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Tue, 5 Oct 2021 11:08:09 +0100 Subject: [PATCH 15/19] Adjusted workflow --- gradle.properties | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index 8c04adbb6..03de8993b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,7 +18,7 @@ systemProp.org.gradle.internal.publish.checksums.insecure=true testOptions.unitTests.isIncludeAndroidResources=true # Set to true to skip tests and even compilation of the iOS target. -skipIosTarget=false +skipIosTarget=true # Skip iOS Tests firebase-app.skipIosTests=false firebase-auth.skipIosTests=true @@ -29,10 +29,10 @@ firebase-functions.skipIosTests=false firebase-config.skipIosTests=false # Versions: -firebase-app.version=1.4.3 -firebase-auth.version=1.4.3 -firebase-common.version=1.4.3 -firebase-database.version=1.4.3 -firebase-firestore.version=1.4.3 -firebase-functions.version=1.4.3 -firebase-config.version=1.4.3 +firebase-app.version=1.4.2 +firebase-auth.version=1.4.2 +firebase-common.version=1.4.2 +firebase-database.version=1.4.2 +firebase-firestore.version=1.4.2 +firebase-functions.version=1.4.2 +firebase-config.version=1.4.2 From 69fbf24b31aca99420accece24ed19bade856e7f Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Tue, 5 Oct 2021 11:20:51 +0100 Subject: [PATCH 16/19] Adjusted workflow --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 03de8993b..94533b4d7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,7 +18,7 @@ systemProp.org.gradle.internal.publish.checksums.insecure=true testOptions.unitTests.isIncludeAndroidResources=true # Set to true to skip tests and even compilation of the iOS target. -skipIosTarget=true +skipIosTarget=false # Skip iOS Tests firebase-app.skipIosTests=false firebase-auth.skipIosTests=true From 38d857007bc2ca107bbea955755b4bb5208b1210 Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Tue, 5 Oct 2021 12:16:38 +0100 Subject: [PATCH 17/19] Added Independant publish tasks --- .github/workflows/publish.yml | 58 +++++++++++++++++++++++++++++++++-- gradle.properties | 14 ++++----- 2 files changed, 63 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0f1a25da5..3d4678a6f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -29,12 +29,66 @@ jobs: run: chmod +x gradlew - name: Install Carthage run: brew install carthage - - name: Publish + - name: Publish Firebase App uses: eskatos/gradle-command-action@v1 with: - arguments: publish + arguments: :firebase-app:publish env: sonatypeUsername: ${{ secrets.SONATYPEUSERNAME }} sonatypePassword: ${{ secrets.SONATYPEPASSWORD }} ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PASSPHRASE }} + - name: Publish Firebase Auth + uses: eskatos/gradle-command-action@v1 + with: + arguments: :firebase-auth:publish + env: + sonatypeUsername: ${{ secrets.SONATYPEUSERNAME }} + sonatypePassword: ${{ secrets.SONATYPEPASSWORD }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PASSPHRASE }} + - name: Publish Firebase Common + uses: eskatos/gradle-command-action@v1 + with: + arguments: :firebase-common:publish + env: + sonatypeUsername: ${{ secrets.SONATYPEUSERNAME }} + sonatypePassword: ${{ secrets.SONATYPEPASSWORD }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PASSPHRASE }} + - name: Publish Firebase Config + uses: eskatos/gradle-command-action@v1 + with: + arguments: :firebase-config:publish + env: + sonatypeUsername: ${{ secrets.SONATYPEUSERNAME }} + sonatypePassword: ${{ secrets.SONATYPEPASSWORD }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PASSPHRASE }} + - name: Publish Firebase Database + uses: eskatos/gradle-command-action@v1 + with: + arguments: :firebase-database:publish + env: + sonatypeUsername: ${{ secrets.SONATYPEUSERNAME }} + sonatypePassword: ${{ secrets.SONATYPEPASSWORD }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PASSPHRASE }} + - name: Publish Firebase Firestore + uses: eskatos/gradle-command-action@v1 + with: + arguments: :firebase-firestore:publish + env: + sonatypeUsername: ${{ secrets.SONATYPEUSERNAME }} + sonatypePassword: ${{ secrets.SONATYPEPASSWORD }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PASSPHRASE }} + - name: Publish Firebase Functions + uses: eskatos/gradle-command-action@v1 + with: + arguments: :firebase-functions:publish + env: + sonatypeUsername: ${{ secrets.SONATYPEUSERNAME }} + sonatypePassword: ${{ secrets.SONATYPEPASSWORD }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PASSPHRASE }} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 94533b4d7..8c04adbb6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -29,10 +29,10 @@ firebase-functions.skipIosTests=false firebase-config.skipIosTests=false # Versions: -firebase-app.version=1.4.2 -firebase-auth.version=1.4.2 -firebase-common.version=1.4.2 -firebase-database.version=1.4.2 -firebase-firestore.version=1.4.2 -firebase-functions.version=1.4.2 -firebase-config.version=1.4.2 +firebase-app.version=1.4.3 +firebase-auth.version=1.4.3 +firebase-common.version=1.4.3 +firebase-database.version=1.4.3 +firebase-firestore.version=1.4.3 +firebase-functions.version=1.4.3 +firebase-config.version=1.4.3 From dbf2d76f6d769009918afad5f93a7c2b05296a09 Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Tue, 5 Oct 2021 13:02:08 +0100 Subject: [PATCH 18/19] Added alpha tag --- gradle.properties | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index 8c04adbb6..dee0b6d0c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -29,10 +29,10 @@ firebase-functions.skipIosTests=false firebase-config.skipIosTests=false # Versions: -firebase-app.version=1.4.3 -firebase-auth.version=1.4.3 -firebase-common.version=1.4.3 -firebase-database.version=1.4.3 -firebase-firestore.version=1.4.3 -firebase-functions.version=1.4.3 -firebase-config.version=1.4.3 +firebase-app.version=1.4.3-alpha +firebase-auth.version=1.4.3-alpha +firebase-common.version=1.4.3-alpha +firebase-database.version=1.4.3-alpha +firebase-firestore.version=1.4.3-alpha +firebase-functions.version=1.4.3-alpha +firebase-config.version=1.4.3-alpha From e912c396d270060f0429bc60585dc9d825d9ffe4 Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Tue, 5 Oct 2021 14:08:16 +0100 Subject: [PATCH 19/19] Removed debug trigger --- .github/workflows/publish.yml | 2 -- gradle.properties | 14 +++++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3d4678a6f..955306bf0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,8 +4,6 @@ name: Publish on: - push: - branches: [ GL-855-fix-upload-issue-with-firebase ] release: types: [prereleased, released] diff --git a/gradle.properties b/gradle.properties index dee0b6d0c..8c04adbb6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -29,10 +29,10 @@ firebase-functions.skipIosTests=false firebase-config.skipIosTests=false # Versions: -firebase-app.version=1.4.3-alpha -firebase-auth.version=1.4.3-alpha -firebase-common.version=1.4.3-alpha -firebase-database.version=1.4.3-alpha -firebase-firestore.version=1.4.3-alpha -firebase-functions.version=1.4.3-alpha -firebase-config.version=1.4.3-alpha +firebase-app.version=1.4.3 +firebase-auth.version=1.4.3 +firebase-common.version=1.4.3 +firebase-database.version=1.4.3 +firebase-firestore.version=1.4.3 +firebase-functions.version=1.4.3 +firebase-config.version=1.4.3