Skip to content

Commit

Permalink
Move the hierarchy template to common-conventions and move the `com…
Browse files Browse the repository at this point in the history
…pose.ui` dependency to the common `composeUiMain` source set
  • Loading branch information
ShreckYe committed Dec 4, 2024
1 parent a8705e5 commit 58da79f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 29 deletions.
14 changes: 14 additions & 0 deletions buildSrc/src/main/kotlin/common-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,21 @@ kotlin {
js()



@OptIn(ExperimentalKotlinGradlePluginApi::class)
applyDefaultHierarchyTemplate {
common {
group("composeUi") {
withJvm()
withAndroidTarget()
group("ios")
withWasmJs()
}
}
}



compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi

plugins {
id("common-conventions")
id("com.huanshankeji.kotlin-multiplatform-conventional-targets")
Expand All @@ -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()) }
Expand Down
18 changes: 5 additions & 13 deletions demo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,30 +57,22 @@ kotlin {
implementation(commonDependencies.kotlinx.coroutines.core())
}
}
composeUiMain {
dependencies {
implementation(compose.ui)
}
}
jvmMain {
dependencies {
implementation(compose.desktop.currentOs)
}
}
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)
Expand Down

0 comments on commit 58da79f

Please sign in to comment.