From f85ed91f33850c67d04014a9e93b3d59cb2a689e Mon Sep 17 00:00:00 2001 From: shreyasm-dev <62489066+shreyasm-dev@users.noreply.github.com> Date: Tue, 25 Jul 2023 08:15:06 +0000 Subject: [PATCH] Add jni feature --- Cargo.toml | 8 +++++--- README.md | 4 ++++ src/lib.rs | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 008d4ce..1a1ea0a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jnat" -version = "0.2.2" +version = "0.2.3" edition = "2021" license = "MIT" description = "A wrapper around the jni crate" @@ -8,8 +8,6 @@ repository = "https://github.com/shreyasm-dev/jnat/" readme = "README.md" categories = ["api-bindings"] -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] jni = "0.21.1" @@ -22,3 +20,7 @@ harness = false inventory = "0.3.11" log = "0.4.19" pretty_env_logger = "0.5.0" + +[features] +default = ["jni"] +jni = [] diff --git a/README.md b/README.md index 76b3a40..008134e 100644 --- a/README.md +++ b/README.md @@ -56,3 +56,7 @@ public class HelloWorld { ``` Compile the java file with `javac -h . HelloWorld.java`. Then, run `java -Djava.library.path=path/to/target/debug HelloWorld`. You should see `Hello, world!` printed to the console. + +## Notes + +- Jnat re-exports jni by default. If you want to use a different version of jni, you can disable either the default features or the `jni` feature. diff --git a/src/lib.rs b/src/lib.rs index 6ffcd47..0b23fb6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ pub mod env; pub mod signature; +#[cfg(feature = "jni")] pub use jni;