kitgit

tirbofish/dropbear · commit

f5ccc4013bd5cc8fc8aadc96b5ae2d35866d2f7c

wip: implemented JNI function headers (finally). doing some testing.

Unverified

Thribhu K <4tkbytes@pm.me> · 2025-12-31 09:03

view full diff

diff --git a/build.gradle.kts b/build.gradle.kts
index 9d7c8ea..06a66f0 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -32,11 +32,17 @@ val libPathProvider = provider {
         layout.projectDirectory.file("libs/$libName").asFile
     )
 
-    candidates.firstOrNull { it.exists() }?.absolutePath ?: ""
+    val foundFile = candidates.firstOrNull { it.exists() }
+    if (foundFile != null) {
+        foundFile.absolutePath
+    } else {
+        println("No Rust library exists")
+        ""
+    }
 }
 
 kotlin {
-    jvm { }
+    jvm {}
 
     val nativeTarget = when {
         isMacOs && isArm64 -> macosArm64("nativeLib")
@@ -65,30 +71,33 @@ kotlin {
                 cinterops {
                     val dropbear by creating {
                         defFile(project.file("src/dropbear.def"))
-                        includeDirs.headerFilterOnly(project.file("headers"))
-                        compilerOpts("-I${project.file("headers").absolutePath}")
+                        includeDirs.headerFilterOnly(project.file("include"))
+                        compilerOpts("-I${project.file("include").absolutePath}")
                     }
                 }
             }
             binaries {
                 sharedLib {
                     baseName = "dropbear"
+
                     if (isLinux || isMacOs) {
                         linkerOpts("-L$nativeLibDir", "-l$nativeLibNameForLinking", "-Wl,-rpath,\\\$ORIGIN")
                     } else if (isMingwX64) {
-                        linkerOpts(file("$nativeLibDir/$nativeLibNameForLinking.dll.lib").absolutePath)
+                        val importLibName = "$nativeLibNameForLinking.dll.lib"
+                        val importLibPath = file("$nativeLibDir/$importLibName").absolutePath
+                        linkerOpts(importLibPath)
                     }
                 }
             }
         }

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