From 58da79ff9fec42a47a89dff169e17dd91078dcd7 Mon Sep 17 00:00:00 2001 From: Yongshun Shreck Ye Date: Wed, 4 Dec 2024 17:48:22 +0800 Subject: [PATCH] Move the hierarchy template to `common-conventions` and move the `compose.ui` dependency to the common `composeUiMain` source set --- .../main/kotlin/common-conventions.gradle.kts | 14 ++++++++++++++ ...b-conventions-without-publishing.gradle.kts | 16 ---------------- demo/build.gradle.kts | 18 +++++------------- 3 files changed, 19 insertions(+), 29 deletions(-) diff --git a/buildSrc/src/main/kotlin/common-conventions.gradle.kts b/buildSrc/src/main/kotlin/common-conventions.gradle.kts index d01eaa4a..2df0e731 100644 --- a/buildSrc/src/main/kotlin/common-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/common-conventions.gradle.kts @@ -38,7 +38,21 @@ kotlin { js() + @OptIn(ExperimentalKotlinGradlePluginApi::class) + applyDefaultHierarchyTemplate { + common { + group("composeUi") { + withJvm() + withAndroidTarget() + group("ios") + withWasmJs() + } + } + } + + + compilerOptions { freeCompilerArgs.add("-Xexpect-actual-classes") } diff --git a/buildSrc/src/main/kotlin/lib-conventions-without-publishing.gradle.kts b/buildSrc/src/main/kotlin/lib-conventions-without-publishing.gradle.kts index 0dcdddb2..052a2868 100644 --- a/buildSrc/src/main/kotlin/lib-conventions-without-publishing.gradle.kts +++ b/buildSrc/src/main/kotlin/lib-conventions-without-publishing.gradle.kts @@ -1,5 +1,3 @@ -import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi - plugins { id("common-conventions") id("com.huanshankeji.kotlin-multiplatform-conventional-targets") @@ -11,20 +9,6 @@ kotlin { publishLibraryVariants("release", "debug") } - // move to `common-conventions` if necessary - - @OptIn(ExperimentalKotlinGradlePluginApi::class) - applyDefaultHierarchyTemplate { - common { - group("composeUi") { - withJvm() - withAndroidTarget() - group("ios") - withWasmJs() - } - } - } - /* sourceSets { val composeUiMain by creating { dependsOn(commonMain.get()) } diff --git a/demo/build.gradle.kts b/demo/build.gradle.kts index 757efc76..b1699b89 100644 --- a/demo/build.gradle.kts +++ b/demo/build.gradle.kts @@ -57,6 +57,11 @@ kotlin { implementation(commonDependencies.kotlinx.coroutines.core()) } } + composeUiMain { + dependencies { + implementation(compose.ui) + } + } jvmMain { dependencies { implementation(compose.desktop.currentOs) @@ -64,23 +69,10 @@ kotlin { } androidMain { dependencies { - // TODO consider putting this in `composeUiMain` - implementation(compose.ui) - implementation(commonDependencies.androidx.activity.compose()) implementation(commonDependencies.androidx.compose.ui.module("tooling-preview")) } } - iosMain { - dependencies { - implementation(compose.ui) - } - } - wasmJsMain { - dependencies { - implementation(compose.ui) - } - } jsMain { dependencies { implementation(compose.html.core)