Ability to specify output artifact name · Issue #4875 · rust-lang/cargo (original) (raw)

Hi!

I'd like to suggest that we should add --output-path option to certain Cargo commands, to make it easier to use Cargo as a part of the larger build system.

Currently, the way to get output artifacts location is to run cargo build --message-format=json and parse the resulting JSON. This is very convenient if you want to "enhance" the stuff that Cargo does. For example, IntelliJ Rust uses this feature to learn what binaries it should launch via debugger.

However, this does not work well for the case where you use Cargo as a part of larger build, and are interested only in the artifact. The main drawback here is that parsing the JSON is not that easy.

Here some implementation considerations:

Issue inspired by this discussion on Gitter: https://gitter.im/rust-lang/rust?at=5a468c4b0163b028108fe9b6