-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add support for customizing JSON diagnostics from Cargo #7214
Conversation
r? @Eh2406 (rust_highfive has picked a reviewer for you, use r? to override) |
ea9feb0
to
7d27976
Compare
r? @ehuss I'm curious to get your thoughts on this before proposing we merge, but before merging I think we'll want to do an FCP sign-off since this adds stable functionality |
So to clarify |
Correct yes, Also for comparison, these are the rustbuild changes necessary to leverage this feature. |
I should also note that I all rustbuild really needs here is |
This looks good to me. I think the flag options here seem good. It is conceivable they will be useful to other people. There are a few test failures that need to be addressed. If we do an fcp, it needs to be done quickly. There is not much time before beta branch, and it may take a while to update. Or stage0 promotion can be delayed, I'm not sure how much people care about that. |
Cargo has of rust-lang#7143 enabled pipelined compilation by default which affects how the compiler is invoked, especially with respect to JSON messages. This, in some testing, has proven to cause quite a few issues with rustbuild's current integration with Cargo. This commit is aimed at adding features to Cargo to solve this issue. This commit adds the ability to customize the stream of JSON messages coming from Cargo. The new feature for Cargo is that it now also mirrors rustc in how you can configure the JSON stream. Multiple `--message-format` arguments are now supported and the value specified is a comma-separated list of directives. In addition to the existing `human`, `short`, and `json` directives these new directives have been added: * `json-render-diagnostics` - instructs Cargo to render rustc diagnostics and only print out JSON messages for artifacts and Cargo things. * `json-diagnostic-short` - indicates that the `rendered` field of rustc diagnostics should use the "short" rendering. * `json-diagnostic-rendered-ansi` - indicates that the `rendered` field of rustc diagnostics should embed ansi color codes. The first option here, `json-render-diagnostics`, will be used by rustbuild unconditionally. Additionally `json-diagnostic-short` will be conditionally used based on the input to rustbuild itself. This should be enough for external tools to customize how Cargo is invoked and how all kinds of JSON diagnostics get printed, and it's thought that we can relatively easily tweak this as necessary to extend it and such.
7d27976
to
45699e9
Compare
Ok! @rfcbot fcp merge |
Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
@bors r+ |
📌 Commit 45699e9 has been approved by |
Add support for customizing JSON diagnostics from Cargo Cargo has of #7143 enabled pipelined compilation by default which affects how the compiler is invoked, especially with respect to JSON messages. This, in some testing, has proven to cause quite a few issues with rustbuild's current integration with Cargo. This commit is aimed at adding features to Cargo to solve this issue. This commit adds the ability to customize the stream of JSON messages coming from Cargo. The new feature for Cargo is that it now also mirrors rustc in how you can configure the JSON stream. Multiple `--message-format` arguments are now supported and the value specified is a comma-separated list of directives. In addition to the existing `human`, `short`, and `json` directives these new directives have been added: * `json-render-diagnostics` - instructs Cargo to render rustc diagnostics and only print out JSON messages for artifacts and Cargo things. * `json-diagnostic-short` - indicates that the `rendered` field of rustc diagnostics should use the "short" rendering. * `json-diagnostic-rendered-ansi` - indicates that the `rendered` field of rustc diagnostics should embed ansi color codes. The first option here, `json-render-diagnostics`, will be used by rustbuild unconditionally. Additionally `json-diagnostic-short` will be conditionally used based on the input to rustbuild itself. This should be enough for external tools to customize how Cargo is invoked and how all kinds of JSON diagnostics get printed, and it's thought that we can relatively easily tweak this as necessary to extend it and such.
☀️ Test successful - checks-azure |
Update cargo 9 commits in 26092da337b948719549cd5ed3d1051fd847afd7..42a8c0adf91323c01228268c651aef5366b25b69 2019-07-31 23:24:32 +0000 to 2019-08-07 20:41:07 +0000 - Add support for customizing JSON diagnostics from Cargo (rust-lang/cargo#7214) - Bump rustfix (rust-lang/cargo#7221) - Fix remap-path-prefix from failing. (rust-lang/cargo#7219) - Clean up build script stuff and documentation. (rust-lang/cargo#7215) - Remove debug panic in package-features. (rust-lang/cargo#7213) - Fix an old test. (rust-lang/cargo#7208) - Remove unused AstBuilder (rust-lang/cargo#7210) - Revert "Release a jobserver token while locking a file" (rust-lang/cargo#7201) - improve error message for unmatched prerelease dependencies (rust-lang/cargo#7191)
Cargo has of #7143 enabled pipelined compilation by default which
affects how the compiler is invoked, especially with respect to JSON
messages. This, in some testing, has proven to cause quite a few issues
with rustbuild's current integration with Cargo. This commit is aimed at
adding features to Cargo to solve this issue.
This commit adds the ability to customize the stream of JSON messages
coming from Cargo. The new feature for Cargo is that it now also mirrors
rustc in how you can configure the JSON stream. Multiple
--message-format
arguments are now supported and the value specifiedis a comma-separated list of directives. In addition to the existing
human
,short
, andjson
directives these new directives have beenadded:
json-render-diagnostics
- instructs Cargo to render rustcdiagnostics and only print out JSON messages for artifacts and Cargo
things.
json-diagnostic-short
- indicates that therendered
field of rustcdiagnostics should use the "short" rendering.
json-diagnostic-rendered-ansi
- indicates that therendered
field of rustcdiagnostics should embed ansi color codes.
The first option here,
json-render-diagnostics
, will be used byrustbuild unconditionally. Additionally
json-diagnostic-short
will beconditionally used based on the input to rustbuild itself.
This should be enough for external tools to customize how Cargo is
invoked and how all kinds of JSON diagnostics get printed, and it's
thought that we can relatively easily tweak this as necessary to extend
it and such.