@@ -9,6 +9,7 @@ plugins {
9
9
alias(libs.plugins.detekt)
10
10
alias(libs.plugins.ktlint)
11
11
alias(libs.plugins.kotlin.binaryCompatibility)
12
+ `maven- publish`
12
13
}
13
14
14
15
repositories {
@@ -30,13 +31,34 @@ kotlin {
30
31
}
31
32
}
32
33
generateTypeScriptDefinitions()
34
+ nodejs()
33
35
}
36
+
34
37
val hostOs = System .getProperty(" os.name" )
35
38
val isMingwX64 = hostOs.startsWith(" Windows" )
36
- val nativeTarget = when {
37
- hostOs == " Mac OS X" -> macosX64(" native" )
38
- hostOs == " Linux" -> linuxX64(" native" )
39
- isMingwX64 -> mingwX64(" native" )
39
+ when {
40
+ hostOs == " Mac OS X" -> {
41
+ macosX64()
42
+ macosArm64()
43
+
44
+ ios()
45
+ iosArm64()
46
+ iosSimulatorArm64()
47
+
48
+ watchos()
49
+ watchosArm32()
50
+ watchosSimulatorArm64()
51
+
52
+ tvos()
53
+ tvosArm64()
54
+ tvosX64()
55
+ }
56
+
57
+ hostOs == " Linux" -> {
58
+ linuxX64()
59
+ linuxArm64()
60
+ }
61
+ isMingwX64 -> mingwX64()
40
62
else -> throw GradleException (" Host OS is not supported in Kotlin/Native." )
41
63
}
42
64
@@ -54,16 +76,24 @@ kotlin {
54
76
implementation(kotlin(" test-annotations-common" ))
55
77
}
56
78
}
57
- val jvmMain by getting
58
79
val jvmTest by getting {
59
80
dependencies {
60
81
implementation(libs.kotest.runner.junit5)
61
82
}
62
83
}
63
- val jsMain by getting
64
- val jsTest by getting
65
- val nativeMain by getting
66
- val nativeTest by getting
84
+ }
85
+
86
+ val publicationsFromMainHost =
87
+ listOf (jvm(), js()).map { it.name } + " kotlinMultiplatform"
88
+ publishing {
89
+ publications {
90
+ matching { it.name in publicationsFromMainHost }.all {
91
+ val targetPublication = this @all
92
+ tasks.withType<AbstractPublishToMaven >()
93
+ .matching { it.publication == targetPublication }
94
+ .configureEach { onlyIf { findProperty(" isMainHost" ) == " true" } }
95
+ }
96
+ }
67
97
}
68
98
}
69
99
@@ -78,7 +108,7 @@ ktlint {
78
108
}
79
109
}
80
110
81
- private val detektAllTask = tasks.register(" detektAll" ) {
111
+ private val detektAllTask by tasks.register(" detektAll" ) {
82
112
dependsOn(tasks.withType<Detekt >())
83
113
}
84
114
0 commit comments