kitgit

tirbofish/dropbear · commit

e99c89b5b503ae1c1b761123c882ff474e79bca6

wip: JNI header implementation is mostly done, a couple more headers before its done. implemented cbindgen generation, but doesnt look like its any good. FARK

Unverified

Thribhu K <4tkbytes@pm.me> · 2025-12-30 17:19

view full diff

diff --git a/Cargo.toml b/Cargo.toml
index 9257b36..299d5a4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -80,6 +80,7 @@ egui_ltreeview = { version = "0.6", features = ["doc"] }
 dyn-hash = "1.0"
 semver = { version = "1.0", features = ["serde"] }
 rapier3d = { version = "0.31", features = [ "simd-stable", "serde-serialize" ] }
+cbindgen = { version = "0.29.2" }
 
 [workspace.dependencies.image]
 version = "0.25"
diff --git a/build.gradle.kts b/build.gradle.kts
index a076e42..9d7c8ea 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -127,7 +127,7 @@ kotlin {
     }
 }
 
-val extractJavaSources by tasks.registering(Sync::class) {
+val extractJavaSources by tasks.registering(Copy::class) {
     group = "jni"
     description = "Copies .java files from jvmMain/kotlin to a temp directory for header generation"
 
@@ -136,9 +136,9 @@ val extractJavaSources by tasks.registering(Sync::class) {
     into(layout.buildDirectory.dir("tmp/java-jni-sources"))
 }
 
-val generateJniHeaders by tasks.registering(JavaCompile::class) {
+val compileJavaForJni by tasks.registering(JavaCompile::class) {
     group = "jni"
-    description = "Generates JNI headers from extracted Java files"
+    description = "Compiles Java sources and generates JNI headers"
 
     dependsOn(extractJavaSources, "compileKotlinJvm")
 
@@ -149,7 +149,7 @@ val generateJniHeaders by tasks.registering(JavaCompile::class) {
         configurations.named("jvmCompileClasspath")
     )
 
-    destinationDirectory.set(layout.buildDirectory.dir("tmp/jni-dummy-classes"))
+    destinationDirectory.set(layout.buildDirectory.dir("tmp/jni-java-classes"))
 
     val headerOutputDir = layout.buildDirectory.dir("generated/jni-headers")
     options.headerOutputDirectory.set(headerOutputDir)
@@ -158,12 +158,78 @@ val generateJniHeaders by tasks.registering(JavaCompile::class) {
         val outDir = headerOutputDir.get().asFile
         if (outDir.exists()) {
             outDir.deleteRecursively()

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