Skip to content

Commit 58660c5

Browse files
committed
chore: checking native debug build time
1 parent 45e99ba commit 58660c5

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

backend/native/build.gradle.kts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import com.google.cloud.tools.jib.api.buildplan.ImageFormat
55
import com.google.cloud.tools.jib.gradle.extension.nativeimage.JibNativeImageExtension
66
import common.*
77
import common.Platform
8-
import org.gradle.internal.os.OperatingSystem
98
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
109
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType
1110
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink
@@ -25,9 +24,8 @@ kotlin {
2524

2625
targets.withType<KotlinNativeTarget>().configureEach {
2726
binaries {
28-
executable(setOf(RELEASE)) {
27+
executable(setOf(DEBUG)) {
2928
entryPoint = "main"
30-
3129
// Fix for libcrypt.so.1 not-found error on distroless
3230
if (target.targetName.startsWith("linux")) {
3331
linkerOpts("--as-needed")
@@ -42,6 +40,10 @@ kotlin {
4240
}
4341
}
4442
}
43+
44+
test(setOf()) {}
45+
46+
// sharedLib { }
4547
}
4648
}
4749

@@ -117,20 +119,20 @@ jib {
117119
sourceSets.maybeCreate("main")
118120

119121
tasks {
120-
val linkReleaseExecutableMacosX64 by getting(KotlinNativeLink::class)
121-
val linkReleaseExecutableMacosArm64 by getting(KotlinNativeLink::class)
122-
122+
val buildType = "Debug"
123123
val macOsUniversalBinary by
124124
registering(Exec::class) {
125+
val macosX64 = named<KotlinNativeLink>("link${buildType}ExecutableMacosX64")
126+
val macosArm64 = named<KotlinNativeLink>("link${buildType}ExecutableMacosArm64")
125127
val binName = "${project.name}-macos"
126-
dependsOn(linkReleaseExecutableMacosX64, linkReleaseExecutableMacosArm64)
128+
dependsOn(macosX64, macosArm64)
127129
commandLine(
128130
"lipo",
129131
"-create",
130132
"-output",
131133
binName,
132-
linkReleaseExecutableMacosX64.outputFile.get(),
133-
linkReleaseExecutableMacosArm64.outputFile.get())
134+
macosArm64.get().outputFile.get(),
135+
macosX64.get().outputFile.get())
134136
workingDir = layout.buildDirectory.dir("bin").get().asFile
135137
group = "Build"
136138
description = "Builds universal macOS binary"
@@ -141,16 +143,16 @@ tasks {
141143
"Universal macOS binary created: ${workingDir.resolve(binName).absolutePath}"))
142144
}
143145

144-
onlyIf { OperatingSystem.current().isMacOsX }
146+
onlyIf { Platform.isMac }
145147
}
146148

147149
val prepareJib by
148150
registering(Copy::class) {
149151
// DefaultNativePlatform.getCurrentArchitecture()
150152
val releaseExecutable =
151153
when {
152-
Platform.isAmd64 -> named("linkReleaseExecutableLinuxX64")
153-
else -> named("linkReleaseExecutableLinuxArm64")
154+
Platform.isAmd64 -> named("link${buildType}ExecutableLinuxX64")
155+
else -> named("link${buildType}ExecutableLinuxArm64")
154156
}
155157

156158
from(releaseExecutable)

backend/native/src/nativeMain/kotlin/wasm/Wasm.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fun execWasm(path: Path, arg: Int = 5) {
2929
}
3030
println("Result: $result")
3131
} else {
32-
println("Wasm file not found: $path")
32+
println("Wasm file not found: $path!")
3333
}
3434
} catch (e: Exception) {
3535
println("Failed to execute wasm: ${e.message}")

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,6 @@ maven.snapshot.repo.enabled=false
6666
# Other projects
6767
composeBuild=true
6868
springBoot=false
69-
kotlin.target.native.enabled=false
69+
kotlin.target.native.enabled=true
7070
kotlin.target.win.enabled=false
7171
debug=false

0 commit comments

Comments
 (0)