[GHC] #13190: Add a flag to dump compiler output as JSON
#13190: Add a flag to dump compiler output as JSON -------------------------------------+------------------------------------- Reporter: mpickering | Owner: mpickering Type: feature | Status: new request | Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): Phab:D3010 | Wiki Page: -------------------------------------+------------------------------------- This ticket is to track the `-ddump-json` flag which is implemented by Phab:D3010. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13190> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13190: Add a flag to dump compiler output as JSON -------------------------------------+------------------------------------- Reporter: mpickering | Owner: mpickering Type: feature request | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3010 Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): I don't know much about JSON but the basic idea seems good. This is just for error messages, right, not for (say `-ddump-simpl`)? Perhaps `-ddump-X` isn't the right connotation. Maybe `-djson-errors`? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13190#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13190: Add a flag to dump compiler output as JSON -------------------------------------+------------------------------------- Reporter: mpickering | Owner: mpickering Type: feature request | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3010 Wiki Page: | -------------------------------------+------------------------------------- Comment (by mpickering): Replying to [comment:1 simonpj]:
I don't know much about JSON but the basic idea seems good.
This is just for error messages, right, not for (say `-ddump-simpl`)?
All compiler output will be formatted as structured JSON. The consumer can filter out logging messages from -ddump-simpl output from warnings as they desire. This information is tracked in the `Severity` argument.
Perhaps `-ddump-X` isn't the right connotation. Maybe `-djson-errors`?
That much is up for discussion. It is named this way as it hooks into the same machinery which controls `-ddump-to-file` and related flags. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13190#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13190: Add a flag to dump compiler output as JSON -------------------------------------+------------------------------------- Reporter: mpickering | Owner: mpickering Type: feature request | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3010 Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj):
All compiler output will be formatted as structured JSON
Including the output of `-dverbose-core2core`, `-ddump-types` etc etc? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13190#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13190: Add a flag to dump compiler output as JSON -------------------------------------+------------------------------------- Reporter: mpickering | Owner: mpickering Type: feature request | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3010 Wiki Page: | -------------------------------------+------------------------------------- Comment (by mpickering): Yes but if you don't want those outputted as json then you can turn off these flags. This actually caught a bug in my implementation as well. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13190#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13190: Add a flag to dump compiler output as JSON -------------------------------------+------------------------------------- Reporter: mpickering | Owner: mpickering Type: feature request | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3010 Wiki Page: | -------------------------------------+------------------------------------- Comment (by mpickering): Another possible design is that all output is formatted as JSON and then it is the tools responsibility to forwards messages on stdout as normal if desired. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13190#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13190: Add a flag to dump compiler output as JSON -------------------------------------+------------------------------------- Reporter: mpickering | Owner: mpickering Type: feature request | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3010 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"91691117fc194c525f58ccd5b266dd1d10493e5a/ghc" 91691117/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="91691117fc194c525f58ccd5b266dd1d10493e5a" Add a flag to emit error messages as JSON This patch adds the flag `-ddump-json` which dumps all the compiler output as a JSON array. This allows tooling to more easily parse GHC's output to display to users. The flag is currently experimental and will hopefully be refined for the next release. In particular I have avoided any changes which involve significant refactoring and provided what is easy given the current infrastructure. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: DanielG, gracjan, thomie Differential Revision: https://phabricator.haskell.org/D3010 GHC Trac Issues: #13190 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13190#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13190: Add a flag to dump compiler output as JSON -------------------------------------+------------------------------------- Reporter: mpickering | Owner: mpickering Type: feature request | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3010 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed Comment: This has been implemented but the interface is still very much a work-in- progress. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13190#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13190: Add a flag to dump compiler output as JSON -------------------------------------+------------------------------------- Reporter: mpickering | Owner: mpickering Type: feature request | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: JSON Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3010 Wiki Page: | -------------------------------------+------------------------------------- Changes (by mpickering): * keywords: => JSON -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13190#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC