From 0879708cf3f4e3cb4e95ae999241e63ecba8ac7c Mon Sep 17 00:00:00 2001 From: takahirom Date: Tue, 22 Aug 2023 11:42:51 +0900 Subject: [PATCH 1/4] Introduce kmp native coroutines --- app-ios-shared/build.gradle.kts | 1 + build-logic/build.gradle.kts | 5 +++++ .../primitive/KmpNativeCoroutinesPlugin.kt | 21 +++++++++++++++++++ gradle/libs.versions.toml | 1 + 4 files changed, 28 insertions(+) create mode 100644 build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/KmpNativeCoroutinesPlugin.kt diff --git a/app-ios-shared/build.gradle.kts b/app-ios-shared/build.gradle.kts index 5c4115599..cc6bb6172 100644 --- a/app-ios-shared/build.gradle.kts +++ b/app-ios-shared/build.gradle.kts @@ -6,6 +6,7 @@ plugins { id("droidkaigi.primitive.kmp") id("droidkaigi.primitive.kmp.ios") id("droidkaigi.primitive.kover") + id("droidkaigi.primitive.kmp.native.coroutines") } kotlin { diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index 6befe1230..5d702f23e 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -76,6 +76,10 @@ gradlePlugin { id = "droidkaigi.primitive.kmp.compose" implementationClass = "io.github.droidkaigi.confsched2023.primitive.KmpComposePlugin" } + register("kotlinMppNativeCoroutines") { + id = "droidkaigi.primitive.kmp.native.coroutines" + implementationClass = "io.github.droidkaigi.confsched2023.primitive.KmpNativeCoroutinesPlugin" + } register("kotlinMppKtorfit") { id = "droidkaigi.primitive.kmp.ktorfit" implementationClass = "io.github.droidkaigi.confsched2023.primitive.KmpKtorfitPlugin" @@ -101,6 +105,7 @@ gradlePlugin { implementationClass = "io.github.droidkaigi.confsched2023.primitive.DetektPlugin" } + // Conventions register("androidFeature") { id = "droidkaigi.convention.androidfeature" diff --git a/build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/KmpNativeCoroutinesPlugin.kt b/build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/KmpNativeCoroutinesPlugin.kt new file mode 100644 index 000000000..ff9844409 --- /dev/null +++ b/build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/KmpNativeCoroutinesPlugin.kt @@ -0,0 +1,21 @@ +package io.github.droidkaigi.confsched2023.primitive + +import org.gradle.api.Plugin +import org.gradle.api.Project + +@Suppress("unused") +class KmpNativeCoroutinesPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply(libs.plugin("kspGradlePlugin").pluginId) + apply("com.rickclephas.kmp.nativecoroutines") + } + kotlin { + sourceSets.all { + languageSettings.optIn("kotlin.experimental.ExperimentalObjCName") + } + } + } + } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index eea24e33c..68f00802d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -143,6 +143,7 @@ roborazziGradlePlugin = { id = "io.github.takahirom.roborazzi", version.ref = "r kspGradlePlugin = { id = "com.google.devtools.ksp", version.ref = "ksp" } kotlinxKover = { id = "org.jetbrains.kotlinx.kover", version = "0.7.3" } detektGradlePlugin = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } +kmpNativeCoroutines = { id = "com.rickclephas.kmp:kmp-nativecoroutines-gradle-plugin", veresion = "1.0.0-ALPHA-17" } [bundles] plugins = [ From b02a563268350fbc3694e1b1d5b47fcdcbe7a95c Mon Sep 17 00:00:00 2001 From: takahirom Date: Tue, 22 Aug 2023 11:45:46 +0900 Subject: [PATCH 2/4] Add kmp native coroutines to plugins --- gradle/libs.versions.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 68f00802d..f2f05b565 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -158,4 +158,5 @@ plugins = [ "kotlinxSerializationGradlePlugin", "completeKotlinPlugin", "detektGradlePlugin", + "kmpNativeCoroutines", ] From 1735f26e265fb1ae1f6b357e1103e5cf455ce8b5 Mon Sep 17 00:00:00 2001 From: Takahiro Menju Date: Tue, 22 Aug 2023 11:50:10 +0900 Subject: [PATCH 3/4] Fix typo --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f2f05b565..0a41ba080 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -143,7 +143,7 @@ roborazziGradlePlugin = { id = "io.github.takahirom.roborazzi", version.ref = "r kspGradlePlugin = { id = "com.google.devtools.ksp", version.ref = "ksp" } kotlinxKover = { id = "org.jetbrains.kotlinx.kover", version = "0.7.3" } detektGradlePlugin = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } -kmpNativeCoroutines = { id = "com.rickclephas.kmp:kmp-nativecoroutines-gradle-plugin", veresion = "1.0.0-ALPHA-17" } +kmpNativeCoroutines = { id = "com.rickclephas.kmp:kmp-nativecoroutines-gradle-plugin", version = "1.0.0-ALPHA-17" } [bundles] plugins = [ From e2f8b4ed4972ead11d6cc4f5e428be8dc7bf7e72 Mon Sep 17 00:00:00 2001 From: Takahiro Menju Date: Tue, 22 Aug 2023 11:53:33 +0900 Subject: [PATCH 4/4] Use lib dependency --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0a41ba080..52ea56301 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -60,6 +60,7 @@ daggerHiltAndroidCompiler = { module = "com.google.dagger:hilt-android-compiler" # for iOS koin = { module = "io.insert-koin:koin-core", version.ref = "koin" } +kmpNativeCoroutines = { module = "com.rickclephas.kmp:kmp-nativecoroutines-gradle-plugin", version = "1.0.0-ALPHA-17" } kotlinxCoroutinesCore = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" } @@ -143,7 +144,6 @@ roborazziGradlePlugin = { id = "io.github.takahirom.roborazzi", version.ref = "r kspGradlePlugin = { id = "com.google.devtools.ksp", version.ref = "ksp" } kotlinxKover = { id = "org.jetbrains.kotlinx.kover", version = "0.7.3" } detektGradlePlugin = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } -kmpNativeCoroutines = { id = "com.rickclephas.kmp:kmp-nativecoroutines-gradle-plugin", version = "1.0.0-ALPHA-17" } [bundles] plugins = [