@@ -5,7 +5,6 @@ import com.google.cloud.tools.jib.api.buildplan.ImageFormat
55import com.google.cloud.tools.jib.gradle.extension.nativeimage.JibNativeImageExtension
66import common.*
77import common.Platform
8- import org.gradle.internal.os.OperatingSystem
98import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
109import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType
1110import 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 {
117119sourceSets.maybeCreate(" main" )
118120
119121tasks {
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)
0 commit comments