#java #generate #kotlin #rust

jni_helper

java function descriptor generate

5 releases

Uses old Rust 2015

0.1.4 Oct 19, 2024
0.1.3 Oct 19, 2024
0.1.2 Oct 19, 2024
0.1.1 Oct 19, 2024
0.1.0 Oct 19, 2024

#1059 in Development tools

Download history 329/week @ 2024-10-17 24/week @ 2024-10-24

353 downloads per month

MIT license

13KB
244 lines

Jni Function Descriptor Generate

Required

  • jdk
  • kotlinc(kotlin)

Usage

  • create build.rs in you project root
    use jni_helper;
    fn main() {
    jni_helper::kt("your/path/RustNative.kt","your/bin/kotlinc.bat","src/kt_jni.rs");//kt
    jni_helper::java("your/path/RustNative.java","your/bin/kotlinc.bat","src/java_jni.rs");//java
    jni_helper::custom("your/path/RustNative.kt",vec!["your/bin/javac","-d","classes/java","-encoding","UTF-8"],"src/java_jni.rs");//custom
    }
    
  • include!() jni.rs in your lib.rs
  • PS:If there are Chinese characters in the Java file, you need to include "-encoding", "UTF-8" in custom javac

Demo

Dependencies

~2–3MB
~54K SLoC