diff --git a/firebase-app/build.gradle.kts b/firebase-app/build.gradle.kts index a45a18ca9..b55e1ec5e 100644 --- a/firebase-app/build.gradle.kts +++ b/firebase-app/build.gradle.kts @@ -57,42 +57,46 @@ 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" + 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,18 +137,26 @@ 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) + 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", true) && it.name.contains("test", true)) { it.enabled = false } + } +} + signing { val signingKey: String? by project val signingPassword: String? by project diff --git a/firebase-auth/build.gradle.kts b/firebase-auth/build.gradle.kts index 54cb61fc2..f359d3152 100644 --- a/firebase-auth/build.gradle.kts +++ b/firebase-auth/build.gradle.kts @@ -80,50 +80,53 @@ 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" + 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() nodejs { @@ -165,18 +168,26 @@ 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) + val iosTest by sourceSets.getting + val iosSimulatorArm64Test by sourceSets.getting + iosSimulatorArm64Test.dependsOn(iosTest) + } val jsMain by getting } } +if (project.property("firebase-auth.skipIosTests") == "true") { + tasks.forEach { + if (it.name.contains("ios", true) && it.name.contains("test", true)) { it.enabled = false } + } +} + signing { val signingKey: String? by project val signingPassword: String? by project 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() } 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 ee32e66bb..c809581df 100644 --- a/firebase-common/build.gradle.kts +++ b/firebase-common/build.gradle.kts @@ -46,8 +46,12 @@ kotlin { publishAllLibraryVariants() } - ios() - iosSimulatorArm64() + val supportIosTarget = project.property("skipIosTarget") != "true" + + if (supportIosTarget) { + ios() + iosSimulatorArm64() + } js { useCommonJs() @@ -92,13 +96,15 @@ 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) + val iosTest by sourceSets.getting + val iosSimulatorArm64Test by sourceSets.getting + iosSimulatorArm64Test.dependsOn(iosTest) + } val jsMain by getting { dependencies { @@ -108,6 +114,12 @@ kotlin { } } +if (project.property("firebase-common.skipIosTests") == "true") { + tasks.forEach { + if (it.name.contains("ios", true) && it.name.contains("test", true)) { 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 fe19b5aa3..6f1bb82c4 100644 --- a/firebase-config/build.gradle.kts +++ b/firebase-config/build.gradle.kts @@ -69,45 +69,48 @@ 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" + 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,18 +146,26 @@ 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) + 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", true) && it.name.contains("test", true)) { 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 352c3b304..196209885 100644 --- a/firebase-database/build.gradle.kts +++ b/firebase-database/build.gradle.kts @@ -56,49 +56,52 @@ 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" + 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,18 +146,26 @@ 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) + val iosTest by sourceSets.getting + val iosSimulatorArm64Test by sourceSets.getting + iosSimulatorArm64Test.dependsOn(iosTest) + } val jsMain by getting } } +if (project.property("firebase-database.skipIosTests") == "true") { + tasks.forEach { + if (it.name.contains("ios", true) && it.name.contains("test", true)) { 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 b3a2e30f2..44a2a001b 100644 --- a/firebase-firestore/build.gradle.kts +++ b/firebase-firestore/build.gradle.kts @@ -59,53 +59,56 @@ 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" + 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,17 +152,26 @@ 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) + 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", true) && it.name.contains("test", true)) { 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 efcb5016d..d9392dffe 100644 --- a/firebase-functions/build.gradle.kts +++ b/firebase-functions/build.gradle.kts @@ -51,49 +51,52 @@ 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" + 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,18 +140,26 @@ 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) + 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", true) && it.name.contains("test", true)) { it.enabled = false } + } +} + signing { val signingKey: String? by project val signingPassword: String? by project diff --git a/gradle.properties b/gradle.properties index 4d4351bea..94533b4d7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,6 +17,17 @@ 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 +# Skip iOS Tests +firebase-app.skipIosTests=false +firebase-auth.skipIosTests=true +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 firebase-auth.version=1.4.2