Skip to content

Commit 20f43d3

Browse files
author
Oleg
committed
Add new targets. Add maven publicatoin plugin
1 parent 27b4a0b commit 20f43d3

File tree

2 files changed

+41
-11
lines changed

2 files changed

+41
-11
lines changed

build.gradle.kts

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ plugins {
99
alias(libs.plugins.detekt)
1010
alias(libs.plugins.ktlint)
1111
alias(libs.plugins.kotlin.binaryCompatibility)
12+
`maven-publish`
1213
}
1314

1415
repositories {
@@ -30,13 +31,34 @@ kotlin {
3031
}
3132
}
3233
generateTypeScriptDefinitions()
34+
nodejs()
3335
}
36+
3437
val hostOs = System.getProperty("os.name")
3538
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()
4062
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
4163
}
4264

@@ -54,16 +76,24 @@ kotlin {
5476
implementation(kotlin("test-annotations-common"))
5577
}
5678
}
57-
val jvmMain by getting
5879
val jvmTest by getting {
5980
dependencies {
6081
implementation(libs.kotest.runner.junit5)
6182
}
6283
}
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+
}
6797
}
6898
}
6999

@@ -78,7 +108,7 @@ ktlint {
78108
}
79109
}
80110

81-
private val detektAllTask = tasks.register("detektAll") {
111+
private val detektAllTask by tasks.register("detektAll") {
82112
dependsOn(tasks.withType<Detekt>())
83113
}
84114

kotlin-js-store/yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1937,7 +1937,7 @@ source-map-resolve@^0.6.0:
19371937
atob "^2.1.2"
19381938
decode-uri-component "^0.2.0"
19391939

1940-
source-map-support@~0.5.20:
1940+
source-map-support@0.5.21, source-map-support@~0.5.20:
19411941
version "0.5.21"
19421942
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f"
19431943
integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==

0 commit comments

Comments
 (0)