Skip to content

Commit

Permalink
Only create .libcnb-cargo/additional-bin if there are additional bi…
Browse files Browse the repository at this point in the history
…naries (#413)

Previously the packaged buildpack would contain an empty
`.libcnb-cargo/additional-bin` directory, even if there were
no additional `exec.d` binaries being bundled in the buildpack.
  • Loading branch information
edmorley authored Jun 20, 2022
1 parent a7eb65d commit 9abeda6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
2 changes: 2 additions & 0 deletions libcnb-package/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [Unreleased]

- Only create `.libcnb-cargo/additional-bin` if there are additional binaries to bundle ([#413](https://github.com/heroku/libcnb.rs/pull/413)).

## [0.1.1] 2022-04-12

- Update project URLs for the GitHub repository move to the `heroku` org ([#388](https://github.com/heroku/libcnb.rs/pull/388)).
Expand Down
27 changes: 15 additions & 12 deletions libcnb-package/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,21 @@ pub fn assemble_buildpack_directory(

create_file_symlink("build", bin_path.join("detect"))?;

let additional_binaries_dir = destination_path
.as_ref()
.join(".libcnb-cargo")
.join("additional-bin");

fs::create_dir_all(&additional_binaries_dir)?;

for (binary_target_name, binary_path) in &buildpack_binaries.additional_target_binary_paths {
fs::copy(
binary_path,
additional_binaries_dir.join(binary_target_name),
)?;
if !buildpack_binaries.additional_target_binary_paths.is_empty() {
let additional_binaries_dir = destination_path
.as_ref()
.join(".libcnb-cargo")
.join("additional-bin");

fs::create_dir_all(&additional_binaries_dir)?;

for (binary_target_name, binary_path) in &buildpack_binaries.additional_target_binary_paths
{
fs::copy(
binary_path,
additional_binaries_dir.join(binary_target_name),
)?;
}
}

Ok(())
Expand Down

0 comments on commit 9abeda6

Please sign in to comment.