Skip to content

Commit

Permalink
properly pass binding_crate_lib_name to java backend
Browse files Browse the repository at this point in the history
  • Loading branch information
fredszaq committed Feb 5, 2024
1 parent 9abe78a commit 83874a5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/bindgen/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ impl Builder {
result.extend_with(&parser::parse_src(x, &self.config)?);
}

let binding_crate_lib_name;

if let Some((lib_dir, binding_lib_name)) = self.lib.clone() {
let lockfile = self.lockfile.as_ref().and_then(|p| p.to_str());

Expand All @@ -388,9 +390,14 @@ impl Builder {
/* existing_metadata = */ None,
)?;

binding_crate_lib_name = cargo.binding_crate_lib_name().to_string();

result.extend_with(&parser::parse_lib(cargo, &self.config)?);
} else if let Some(cargo) = self.lib_cargo.clone() {
binding_crate_lib_name = cargo.binding_crate_lib_name().to_string();
result.extend_with(&parser::parse_lib(cargo, &self.config)?);
} else {
binding_crate_lib_name = String::new()
}

result.source_files.extend_from_slice(self.srcs.as_slice());
Expand All @@ -406,9 +413,7 @@ impl Builder {
result.typedefs,
result.functions,
result.source_files,
self.lib_cargo
.map(|cargo| cargo.binding_crate_lib_name().to_string())
.unwrap_or_default(),
binding_crate_lib_name,
)
.generate()
}
Expand Down

0 comments on commit 83874a5

Please sign in to comment.