fix: put java commands behind feature flag

This commit is contained in:
zaaarf 2024-03-10 01:22:05 +01:00
parent 71006696ee
commit 136ce6b052
2 changed files with 32 additions and 25 deletions

View file

@ -41,3 +41,4 @@ rifgen = { git = "https://github.com/Kofituo/rifgen.git", rev = "d27d9785b2febcf
[features]
default = []
java = ["lazy_static", "jni", "jni-sys", "flapigen", "rifgen", "log"]
java-artifact = ["java"]

View file

@ -37,7 +37,12 @@ fn main() {
out_dir.join("glue.rs")
);
//TODO panic if no jdk
#[cfg(feature = "java-artifact")] {
// panic if no jdk
std::process::Command::new("javac")
.arg("--version")
.status()
.expect("java not found");
// compile java code
let mut java_compiled = java_target.clone(); // target/debug/java/classes
@ -69,6 +74,7 @@ fn main() {
println!("cargo:rerun-if-changed={}", generated_glue_file.display());
}
}
}
fn recreate_path(path: &std::path::PathBuf) {
if path.exists() {