kitgit

tirbofish/dropbear · commit

d4725ccae34193d43072ffc3b453095d959f6a9b

18 hours on this commit, and fuckass kotlin native doesnt work for shit. i hate this ugh

Unverified

tk <4tkbytes@pm.me> · 2025-10-07 10:15

view full diff

diff --git a/build.gradle.kts b/build.gradle.kts
index cbfc7df..065e082 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,5 +1,6 @@
 plugins {
-    kotlin("jvm") version "2.1.21"
+    alias(libs.plugins.kotlinMultiplatform)
+    alias(libs.plugins.kotlinxSerialization)
 }
 
 group = "com.dropbear"
@@ -9,21 +10,61 @@ repositories {
     mavenCentral()
 }
 
-dependencies {
-    testImplementation(kotlin("test"))
-    implementation(kotlin("test"))
-}
-
-tasks.test {
-    useJUnitPlatform()
-}
 kotlin {
-    jvmToolchain(21)
-}
+    jvm()
+
+    val hostOs = System.getProperty("os.name")
+    val isArm64 = System.getProperty("os.arch") == "aarch64"
+    val isMingwX64 = hostOs.startsWith("Windows")
+    val nativeTarget = when {
+        hostOs == "Mac OS X" && isArm64 -> macosArm64("nativeLib")
+        hostOs == "Mac OS X" && !isArm64 -> macosX64("nativeLib")
+        hostOs == "Linux" && isArm64 -> linuxArm64("nativeLib")
+        hostOs == "Linux" && !isArm64 -> linuxX64("nativeLib")
+        isMingwX64 -> mingwX64("nativeLib")
+        else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
+    }
+
+    nativeTarget.apply {
+        compilations.getByName("main") {
+            cinterops {
+                val dropbear by creating {
+                    defFile(project.file("src/nativeInterop/cinterop/dropbear.def"))
+                    includeDirs.headerFilterOnly(project.file("src/nativeInterop/cinterop"))
+                }
+            }
+        }

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