burtonageo/cargo-bundle

`cargo-bundle` should use `bin` target name instead of package name

rhysd opened this issue · 0 comments

rhysd commented

My application's binary name is different from its package name.

[package]
name = "foo-app"

[[bin]]
name = "foo"
path = "src/main.rs"

This is necessary to avoid package name conflict on crates.io. However, cargo-bundle uses the package.name to find a binary name. Due to the above configuration, target/release/foo exists but target/release/foo-app does not exist in my project. As the result, cargo bundle reported the following error message:

error: Failed to copy binary from "/path/to/my-app/target/release/foo-app"
  Caused by: "/path/to/my-app/target/release/foo-app" does not exist
stack backtrace:
   0: backtrace::backtrace::trace_unsynchronized
   1: backtrace::backtrace::trace
   2: backtrace::capture::Backtrace::create
   3: backtrace::capture::Backtrace::new_unresolved
   4: error_chain::backtrace::imp::InternalBacktrace::new
   5: <error_chain::State as core::default::Default>::default
   6: cargo_bundle::Error::from_kind
   7: <cargo_bundle::Error as core::convert::From<alloc::string::String>>::from
   8: <T as core::convert::Into<U>>::into
   9: cargo_bundle::bundle::common::copy_file
  10: cargo_bundle::bundle::osx_bundle::copy_binary_to_bundle
  11: cargo_bundle::bundle::osx_bundle::bundle_project
  12: cargo_bundle::bundle::bundle_project
  13: core::ops::function::FnOnce::call_once
  14: core::result::Result<T,E>::and_then
  15: cargo_bundle::run
  16: cargo_bundle::main
  17: core::ops::function::FnOnce::call_once
  18: std::sys_common::backtrace::__rust_begin_short_backtrace
  19: std::rt::lang_start::{{closure}}
  20: std::rt::lang_start_internal
  21: std::rt::lang_start
  22: main

Expected behavior is that cargo-bundle uses the bin target name (foo) instead of the package name (foo-app) to find the binary file in target directory.