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 Oct 4, 2023
1 parent 7a6b8ad commit a9b2175
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 a9b2175

Please sign in to comment.