1
- =======================
2
1
Parseable Driver Output
3
2
=======================
4
3
5
- .. contents ::
6
- :local:
7
-
8
- .. highlight :: none
9
-
10
4
Introduction
11
5
============
12
6
@@ -21,13 +15,15 @@ Message Format
21
15
The parseable output provided by the Swift driver is provided as messages
22
16
encoded in JSON objects. All messages are structured like this::
23
17
24
- <Message Length>\n
25
- {
26
- "kind": "<Message Kind>",
27
- "name": "<Message Name>",
28
- "<key>": "<value>",
29
- ...
30
- }\n
18
+ ```
19
+ <Message Length>\n
20
+ {
21
+ "kind": "<Message Kind>",
22
+ "name": "<Message Name>",
23
+ "<key>": "<value>",
24
+ ...
25
+ }\n
26
+ ```
31
27
32
28
This allows the driver to pass as much information as it wants about the ongoing
33
29
compilation, and programs which parse this data can decide what to use and what
@@ -65,9 +61,6 @@ If "pid" is greater than 0 it will always match the value in "process.real_pid".
65
61
Message Kinds
66
62
=============
67
63
68
- .. contents ::
69
- :local:
70
-
71
64
The driver may emit four kinds of messages: "began", "finished", "signalled",
72
65
and "skipped".
73
66
@@ -85,33 +78,33 @@ will specify the command which was executed under the "command_executable" and
85
78
To get the real process identifier for the process that started, get the value
86
79
of "process.real_pid".
87
80
88
- Example::
89
-
90
- {
91
- "kind": "began",
92
- "name": "compile",
93
- "pid": 12345,
94
- "process": {
95
- "real_pid": 12345
81
+ ``` json
82
+ {
83
+ "kind" : " began" ,
84
+ "name" : " compile" ,
85
+ "pid" : 12345 ,
86
+ "process" : {
87
+ "real_pid" : 12345
88
+ },
89
+ "inputs" : [" /src/foo.swift" ],
90
+ "outputs" : [
91
+ {
92
+ "type" : " object" ,
93
+ "path" : " /build/foo.o"
96
94
},
97
- "inputs": ["/src/foo.swift"],
98
- "outputs": [
99
- {
100
- "type": "object",
101
- "path": "/build/foo.o"
102
- },
103
- {
104
- "type": "swiftmodule",
105
- "path": "/build/foo.swiftmodule"
106
- },
107
- {
108
- "type": "diagnostics",
109
- "path": "/build/foo.dia"
110
- },
111
- ],
112
- "command_executable": "swift",
113
- "command_arguments" : ["-frontend", "-c", "-primary-file", "/src/foo.swift", "/src/bar.swift", "-emit-module-path", "/build/foo.swiftmodule", "-emit-diagnostics-path", "/build/foo.dia"]
114
- }
95
+ {
96
+ "type" : " swiftmodule" ,
97
+ "path" : " /build/foo.swiftmodule"
98
+ },
99
+ {
100
+ "type" : " diagnostics" ,
101
+ "path" : " /build/foo.dia"
102
+ },
103
+ ],
104
+ "command_executable" : " swift" ,
105
+ "command_arguments" : [" -frontend" , " -c" , " -primary-file" , " /src/foo.swift" , " /src/bar.swift" , " -emit-module-path" , " /build/foo.swiftmodule" , " -emit-diagnostics-path" , " /build/foo.dia" ]
106
+ }
107
+ ```
115
108
116
109
Finished Message
117
110
----------------
@@ -124,23 +117,23 @@ missing, no output was generated by the task.
124
117
It will contain the process identifier of the operating system and usage under
125
118
the "process" key. The usage is optional and could be omitted.
126
119
127
- Example::
128
-
129
- {
130
- "kind": "finished",
131
- "name": "compile",
132
- "pid": 12345,
133
- "exit-status": 0,
134
- "process": {
135
- "real_pid": 12345,
136
- "usage": {
137
- "utime": 22740,
138
- "stime": 91107,
139
- "maxrss": 7745536
140
- }
141
- }
142
- // "output" key omitted because there was no stdout/stderr.
120
+ ``` json
121
+ {
122
+ "kind" : " finished" ,
123
+ "name" : " compile" ,
124
+ "pid" : 12345 ,
125
+ "exit-status" : 0 ,
126
+ "process" : {
127
+ "real_pid" : 12345 ,
128
+ "usage" : {
129
+ "utime" : 22740 ,
130
+ "stime" : 91107 ,
131
+ "maxrss" : 7745536
143
132
}
133
+ }
134
+ // "output" key omitted because there was no stdout/stderr.
135
+ }
136
+ ```
144
137
145
138
Signalled Message
146
139
-----------------
@@ -157,22 +150,24 @@ the "process" key. The usage is optional and could be omitted.
157
150
158
151
Example::
159
152
160
- {
161
- "kind": "signalled",
162
- "name": "compile",
163
- "pid": 12345,
164
- "error-message": "Segmentation fault: 11",
165
- "signal": 4,
166
- "process": {
167
- "real_pid": 12345,
168
- "usage": {
169
- "utime": 22740,
170
- "stime": 91107,
171
- "maxrss": 7745536
172
- }
173
- }
174
- // "output" key omitted because there was no stdout/stderr.
153
+ ``` json
154
+ {
155
+ "kind" : " signalled" ,
156
+ "name" : " compile" ,
157
+ "pid" : 12345 ,
158
+ "error-message" : " Segmentation fault: 11" ,
159
+ "signal" : 4 ,
160
+ "process" : {
161
+ "real_pid" : 12345 ,
162
+ "usage" : {
163
+ "utime" : 22740 ,
164
+ "stime" : 91107 ,
165
+ "maxrss" : 7745536
175
166
}
167
+ }
168
+ // "output" key omitted because there was no stdout/stderr.
169
+ }
170
+ ```
176
171
177
172
Skipped Message
178
173
---------------
@@ -181,29 +176,29 @@ A "skipped" message indicates that the driver determined a command did not need
181
176
run during the current compilation. A "skipped" message is equivalent to a "began"
182
177
message, with the exception that it does not include the "pid" key.
183
178
184
- Example::
185
-
186
- {
187
- "kind ": "skipped ",
188
- "name ": "compile" ,
189
- "inputs ": ["/src/foo.swift"],
190
- "outputs": [
191
- {
192
- "type ": "object",
193
- "path": "/build/foo.o"
194
- },
195
- {
196
- "type ": "swiftmodule",
197
- "path": "/build/foo.swiftmodule"
198
- },
199
- {
200
- "type ": "diagnostics",
201
- "path": "/build/foo.dia"
202
- } ,
203
- ] ,
204
- "command_executable": " swift",
205
- "command_arguments": ["-frontend", "-c", "-primary-file", "/src/foo.swift", "/src/bar.swift", "-emit-module-path", "/build/foo.swiftmodule", "-emit-diagnostics-path", "/build/foo.dia"]
206
- }
179
+ ``` json
180
+ {
181
+ "kind" : " skipped " ,
182
+ "name " : " compile " ,
183
+ "inputs " : [ " /src/foo.swift " ] ,
184
+ "outputs " : [
185
+ {
186
+ "type" : " object " ,
187
+ "path " : " /build/foo.o "
188
+ },
189
+ {
190
+ "type" : " swiftmodule " ,
191
+ "path " : " /build/foo. swiftmodule"
192
+ },
193
+ {
194
+ "type" : " diagnostics " ,
195
+ "path " : " /build/foo.dia "
196
+ },
197
+ ] ,
198
+ "command_executable" : " swift " ,
199
+ "command_arguments" : [ " -frontend " , " -c " , " -primary-file " , " /src/foo.swift " , " /src/bar. swift" , " -emit-module-path " , " /build/foo.swiftmodule " , " -emit-diagnostics-path " , " /build/foo.dia " ]
200
+ }
201
+ ```
207
202
208
203
Message Names
209
204
=============
0 commit comments