From 0879708cf3f4e3cb4e95ae999241e63ecba8ac7c Mon Sep 17 00:00:00 2001 From: takahirom Date: Tue, 22 Aug 2023 11:42:51 +0900 Subject: [PATCH] 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 = [