From 2ec544b1dfe6fcceb4f70602209dd2be78bc29dc Mon Sep 17 00:00:00 2001 From: shreyasm-dev <62489066+shreyasm-dev@users.noreply.github.com> Date: Mon, 24 Jul 2023 17:23:18 +0000 Subject: [PATCH] Fix cleanup on Windows --- Cargo.toml | 2 +- integration/main.rs | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0645a94..648436f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jnat" -version = "0.2.0" +version = "0.2.1" edition = "2021" license = "MIT" description = "A wrapper around the jni crate" diff --git a/integration/main.rs b/integration/main.rs index a002deb..0e0c189 100644 --- a/integration/main.rs +++ b/integration/main.rs @@ -20,8 +20,9 @@ static DYLIB_EXTENSION: &str = "so"; #[cfg(target_os = "windows")] static DYLIB_EXTENSION: &str = "dll"; -// TODO: Ensure this works correctly fn get_dylib_name(lib: &str) -> String { + #[cfg(target_os = "windows")] + return format!("{}.{}", lib, DYLIB_EXTENSION); format!("lib{}.{}", lib, DYLIB_EXTENSION) } @@ -172,6 +173,18 @@ fn main() { remove_file(Path::new("out").join(format!("{}.class", t.java_class))) .expect(format!("Failed to remove {}.class", t.java_class).as_str()); + + #[cfg(target_os = "windows")] + { + remove_file(Path::new("out").join(format!("{}.exp", get_dylib_name(t.lib)))) + .expect(format!("Failed to remove {}.lib", get_dylib_name(t.lib)).as_str()); + + remove_file(Path::new("out").join(format!("{}.lib", get_dylib_name(t.lib)))) + .expect(format!("Failed to remove {}.lib", get_dylib_name(t.lib)).as_str()); + + remove_file(Path::new("out").join(format!("{}.pdb", t.lib))) + .expect(format!("Failed to remove {}.pdb", t.lib).as_str()); + } } teardown();