Skip to content

Commit a7a75c7

Browse files
author
Abduqodiri Qurbonzoda
committed
Fix build that fails when ran from IDEA
1 parent b74dee3 commit a7a75c7

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

examples/kotlin-multiplatform/build.gradle

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import org.jetbrains.kotlin.konan.target.HostManager
2+
import org.jetbrains.kotlin.konan.target.KonanTarget
3+
14
plugins {
25
id 'org.jetbrains.kotlin.multiplatform'
36
id 'org.jetbrains.kotlin.plugin.allopen' version "1.6.0"
@@ -13,10 +16,10 @@ kotlin {
1316
jvm()
1417
js('jsIr', IR) { nodejs() }
1518
js { nodejs() }
16-
macosX64 {}
17-
macosArm64 {}
18-
linuxX64 {}
19-
mingwX64 {}
19+
if (HostManager.host == KonanTarget.MACOS_X64.INSTANCE) macosX64('native')
20+
if (HostManager.host == KonanTarget.MACOS_ARM64.INSTANCE) macosArm64('native')
21+
if (HostManager.hostIsLinux) linuxX64('native')
22+
if (HostManager.hostIsMingw) mingwX64('native')
2023

2124
sourceSets.all {
2225
languageSettings {
@@ -39,11 +42,6 @@ kotlin {
3942

4043
nativeMain {
4144
dependsOn(commonMain)
42-
43-
macosX64Main.dependsOn(it)
44-
macosArm64Main.dependsOn(it)
45-
linuxX64Main.dependsOn(it)
46-
mingwX64Main.dependsOn(it)
4745
}
4846
}
4947
}
@@ -103,10 +101,7 @@ benchmark {
103101
}
104102
register("jsIr")
105103
register("js")
106-
register("macosX64")
107-
register("macosArm64")
108-
register("linuxX64")
109-
register("mingwX64")
104+
register("native")
110105
}
111106
}
112107

integration/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fun Project.getSystemProperty(key: String): String? {
2929

3030
val nativeTargetName
3131
get() = when {
32-
project.getSystemProperty("idea.active") == "true" -> "native"
32+
project.getSystemProperty("idea.active") == "true" -> if (HostManager.hostIsMac) "darwin" else "native"
3333
HostManager.hostIsLinux -> "linuxX64"
3434
HostManager.hostIsMingw -> "mingwX64"
3535
HostManager.host == KonanTarget.MACOS_X64 -> "macosX64"

0 commit comments

Comments
 (0)