-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Currently --message-format=json
just dumps the list of files that was produced when compiling a project. Cargo doesn't have too much knowledge about what exactly is produced for which target and crate type, but it should indicate at least which artifact is an executable binary. This is important for IDEs, which at the moment have to implement ugly work-arounds to separate actual binaries from debuginfo, for example (see vadimcn/codelldb#104).
Some pointers to code:
- a struct representing JSON messages:
cargo/src/cargo/util/machine_message.rs
Line 30 in 3b14988
pub struct Artifact<'a> { - the place where we actually print the info:
cargo/src/cargo/core/compiler/mod.rs
Lines 603 to 612 in 3b14988
if json_messages { machine_message::emit(&machine_message::Artifact { package_id: &package_id, target: &target, profile: &profile, features, filenames: destinations, fresh, }); } - a struct which knows where the binaries are:
cargo/src/cargo/core/compiler/compilation.rs
Lines 17 to 21 in 3b14988
/// An array of all tests created during this compilation. pub tests: Vec<(Package, TargetKind, String, PathBuf)>, /// An array of all binaries created. pub binaries: Vec<PathBuf>,
I think we could perhaps add an executable: Option<PathBuf>
field to the CompilerArtifact
?