Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ zip = { version = "0.2", default-features = false }

[build-dependencies]
log = "0.3"
env_logger = "0.3"
env_logger = "0.3"
bindgen = "^0.28.0"

35 changes: 35 additions & 0 deletions build-helper-class.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
extern crate bindgen;

use std::env;
use std::path::PathBuf;
use std::process::Command;

fn main() {
Expand All @@ -20,4 +23,36 @@ fn main() {
println!("Gradle stdout: {}", String::from_utf8_lossy(&output.stdout));
println!("Gradle stderr: {}", String::from_utf8_lossy(&output.stderr));
assert!(output.status.success());


let bindings = bindgen::builder()
.header("src/jvmti_sys/wrapper.h")

// We want jni defs from the jni-sys crate
.raw_line("use jni_sys::*;")
.whitelist_recursively(false)

.whitelisted_type(".*JVMTI.*")
.whitelisted_type(".*jvmti.*")
.whitelisted_type("^jlocation")
.whitelisted_type("^jthread.*")
.whitelisted_type("^jniNativeInterface$")

// This is not defined in jni-sys for some reason
.whitelisted_type("^_?jrawMonitorID")

.whitelisted_var(".*JVMTI.*")
.whitelisted_var(".*jvmti.*")

.derive_default(true)

.generate()
.expect("Unable to generate bindings");


// Write the bindings to the $OUT_DIR/bindings.rs file.
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
}
Loading