Skip to content
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

Merged
merged 1 commit into from
Aug 7, 2019

Commits on Aug 5, 2019

  1. Add support for customizing JSON diagnostics from Cargo

    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.
    alexcrichton committed Aug 5, 2019
    Configuration menu
    Copy the full SHA
    45699e9 View commit details
    Browse the repository at this point in the history