kitgit

tirbofish/dropbear · commit

38bffeb518f975d5fa275a5f795c69537684496f

ci: fix build.gradle.kts

Unverified

tk <4tkbytes@pm.me> · 2025-10-20 14:52

view full diff

diff --git a/build.gradle.kts b/build.gradle.kts
index f9a73d0..33afdba 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -37,7 +37,7 @@ val libPathProvider = provider {
         foundFile.absolutePath
     } else {
         println("No Rust library exists")
-        ""
+        null
     }
 }
 
@@ -55,37 +55,51 @@ kotlin {
         else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
     }
 
-    val nativeLibPath = libPathProvider.get()
-    val nativeLibDir = file(nativeLibPath).parentFile.absolutePath
-    val nativeLibFileName = file(nativeLibPath).name
-    val nativeLibNameForLinking = when {
-        isMacOs -> nativeLibFileName.removePrefix("lib").removeSuffix(".dylib")
-        isLinux -> nativeLibFileName.removePrefix("lib").removeSuffix(".so")
-        isMingwX64 -> nativeLibFileName.removeSuffix(".dll")
-        else -> throw GradleException("Unsupported OS for library name derivation.")
-    }
+    val nativeLibPathRaw = libPathProvider.get()
+
+    if (nativeLibPathRaw != null && nativeLibPathRaw.isNotBlank()) {
+        val nativeLibPath = file(nativeLibPathRaw)
+        val nativeLibDir = nativeLibPath.parentFile.absolutePath
+        val nativeLibFileName = nativeLibPath.name
+        val nativeLibNameForLinking = when {
+            isMacOs -> nativeLibFileName.removePrefix("lib").removeSuffix(".dylib")
+            isLinux -> nativeLibFileName.removePrefix("lib").removeSuffix(".so")
+            isMingwX64 -> nativeLibFileName.removeSuffix(".dll")
+            else -> throw GradleException("Unsupported OS for library name derivation.")
+        }
 
-    nativeTarget.apply {
-        compilations.getByName("main") {
-            cinterops {
-                val dropbear by creating {
-                    defFile(project.file("src/dropbear.def"))
-                    includeDirs.headerFilterOnly(project.file("headers"))
+        nativeTarget.apply {
+            compilations.getByName("main") {
+                cinterops {
+                    val dropbear by creating {
+                        defFile(project.file("src/dropbear.def"))

Large diffs are not rendered by default. Showing the first 50 of 92 lines. Show full diff