-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--message-format=json should indicate which produced files are executables #5426
Comments
@matklad I can give this a try if no one else already started working on it. |
Awesome! I think the relevant test for this is this one: cargo/tests/testsuite/build.rs Line 3994 in 6cd841f
|
@matklad This is perhaps a stupid question, but how can I know which binary in |
@patriksvensson all binaries in cargo/src/cargo/core/compiler/context/mod.rs Line 164 in 151f37c
I think that logic needs to be duplicated when emitting JSON messages. |
Hm, I think that code is buggy actually! Filed #5474 about it. Would you like to tackle that first? |
@matklad Sure, I can try that one first. |
Will go ahead with this one now then. |
I've not given up on this. Simply just been a lot of work. Planning on continue working on the PR later today. |
Hey @patriksvensson, how close to completion is https://github.com/patriksvensson/cargo/tree/feature/GH-5426 ? Are you still interested in working on this? Otherwise, I could try and rebase your work and finish it off... |
@dwijnand Go ahead! I ran out of free time and encountered a lot of merge conflicts, and then the PR was closed because of inactivity 😄 |
@dwijnand I think that the PR is close to completion, but can't remember to be honest. |
Include executable in JSON output. Fixes #5426 Rebase of @patriksvensson's #5517 CC @matklad I didn't really get into the issue or the code, I just interatively rebased Patrik's branch and then massaged and cleaned up the code until the tests passed. So please double check it for code correctness, test case correctness and test case coverage. Particularly the branch changed an if condition according to [this suggestion](#5517 (comment)) by Aleksey. I rolled that back because at one point it helped fix a series of tests. But let me know if that should be included here.
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:
cargo/src/cargo/util/machine_message.rs
Line 30 in 3b14988
cargo/src/cargo/core/compiler/mod.rs
Lines 603 to 612 in 3b14988
cargo/src/cargo/core/compiler/compilation.rs
Lines 17 to 21 in 3b14988
I think we could perhaps add an
executable: Option<PathBuf>
field to theCompilerArtifact
?The text was updated successfully, but these errors were encountered: