Skip to content

Commit d96c2eb

Browse files
committed
Refactor Kotlin targets code in build scripts
1 parent 27edd48 commit d96c2eb

File tree

7 files changed

+20
-52
lines changed

7 files changed

+20
-52
lines changed

library/build.gradle.kts

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ plugins {
77
alias(libs.plugins.compose.multiplatform)
88
alias(libs.plugins.compose.compiler)
99
alias(libs.plugins.android.library)
10-
alias(libs.plugins.dokka)
1110
alias(libs.plugins.maven.publish)
11+
alias(libs.plugins.dokka)
1212
}
1313

1414
group = "ir.mahozad.multiplatform"
@@ -17,27 +17,12 @@ version = "2.1.0-rc"
1717
kotlin {
1818
androidTarget { publishLibraryVariants("release") }
1919
jvm(name = "desktop") // Windows, Linux, macOS (with Java runtime)
20-
js(compiler = IR) { // Kotlin/JS drawing to a canvas
21-
nodejs()
22-
browser()
23-
binaries.executable()
24-
}
20+
js(IR) { browser() } // Kotlin/JS drawing to a canvas
2521
@OptIn(ExperimentalWasmDsl::class)
26-
wasmJs { // Kotlin/Wasm drawing to a canvas
27-
nodejs()
28-
browser()
29-
binaries.executable()
30-
}
31-
listOf(
32-
iosX64(),
33-
iosArm64(),
34-
iosSimulatorArm64()
35-
).forEach { iosTarget ->
36-
iosTarget.binaries.framework {
37-
baseName = "library"
38-
isStatic = true
39-
}
40-
}
22+
wasmJs { browser() } // Kotlin/Wasm drawing to a canvas
23+
iosX64()
24+
iosArm64()
25+
iosSimulatorArm64()
4126

4227
sourceSets {
4328
commonMain.dependencies {

showcase/desktopApp/build.gradle.kts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ plugins {
77
}
88

99
kotlin {
10-
jvm()
10+
jvm(name = "desktop")
1111
sourceSets {
12-
jvmMain.dependencies {
13-
implementation(compose.desktop.currentOs)
14-
implementation(projects.showcase.shared)
12+
@Suppress("unused")
13+
val desktopMain by getting {
14+
dependencies {
15+
implementation(compose.desktop.currentOs)
16+
implementation(projects.showcase.shared)
17+
}
1518
}
1619
}
1720
}
File renamed without changes.
File renamed without changes.

showcase/jsApp/build.gradle.kts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ plugins {
55
}
66

77
kotlin {
8-
js(compiler = IR) {
9-
browser()
10-
nodejs()
11-
binaries.executable()
12-
}
8+
js(IR) { browser() }
139
sourceSets {
1410
jsMain.dependencies {
1511
implementation(compose.html.core)

showcase/shared/build.gradle.kts

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,11 @@ plugins {
99
}
1010

1111
kotlin {
12+
androidTarget()
1213
jvm(name = "desktop")
13-
js(compiler = IR) {
14-
browser()
15-
nodejs()
16-
binaries.executable()
17-
}
14+
js(IR) { browser() }
1815
@OptIn(ExperimentalWasmDsl::class)
19-
wasmJs {
20-
browser()
21-
nodejs()
22-
binaries.executable()
23-
}
24-
androidTarget()
16+
wasmJs { browser() }
2517
// Remember to uncomment kotlin("native.cocoapods") above as well
2618
// iosX64()
2719
// iosArm64()
@@ -45,24 +37,19 @@ kotlin {
4537
implementation(compose.foundation)
4638
implementation(compose.material)
4739
implementation(compose.components.resources)
48-
// api("ir.mahozad.multiplatform:wavy-slider:x.y.z")
4940
api(projects.wavySlider)
5041
}
5142
androidMain.dependencies {
5243
api(libs.androidx.activity.compose)
5344
api(libs.androidx.appcompat)
5445
api(libs.androidx.core.ktx)
5546
}
47+
@Suppress("unused")
5648
val desktopMain by getting {
5749
dependencies {
5850
implementation(compose.desktop.common)
5951
}
6052
}
61-
val jsMain by getting
62-
// See above
63-
// val iosX64Main by getting
64-
// val iosArm64Main by getting
65-
// val iosSimulatorArm64Main by getting
6653
}
6754
}
6855

showcase/wasmApp/build.gradle.kts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,9 @@ plugins {
88

99
kotlin {
1010
@OptIn(ExperimentalWasmDsl::class)
11-
wasmJs {
12-
browser()
13-
nodejs()
14-
binaries.executable()
15-
}
11+
wasmJs { browser() }
1612
sourceSets {
13+
@Suppress("unused")
1714
val wasmJsMain by getting {
1815
dependencies {
1916
implementation(compose.runtime)

0 commit comments

Comments
 (0)