Skip to content

Commit e6dd280

Browse files
authored
Made YAML version of vscode workspace to avoid redundancy (flutter#55322)
In flutter/engine#55291 we added a vscode workspace to help with running tests and sharing settings. However, VSCode does not support a config format that has the ability to reduce redundancy and it will get quite unwieldy as we add in all of the engines test runners. To combat that I've added instead a YAML config that can converted to JSON for VSCode. This also adds 2 more test runners: display_list_unittests and impeller_golden_tests [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
1 parent 78aebbb commit e6dd280

5 files changed

Lines changed: 464 additions & 17 deletions

File tree

engine.code-workspace

Lines changed: 143 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Don't edit directly, see //tools/vscode_workspace for a script
2+
// that can refresh this from yaml.
13
{
24
"folders": [
35
{
@@ -126,7 +128,7 @@
126128
"C_Cpp.default.includePath": [
127129
"${default}",
128130
"${workspaceFolder}/..",
129-
"${workspaceFolder}",
131+
"${workspaceFolder}"
130132
],
131133
"dotnet.defaultSolution": "disable",
132134
"dart.showTodos": false,
@@ -144,6 +146,32 @@
144146
"--enable_playground"
145147
]
146148
}
149+
},
150+
{
151+
"name": "display_list_unittests_arm64",
152+
"pattern": "../out/host_debug_unopt_arm64/display_list_unittests",
153+
"runTask": {
154+
"before": [
155+
"display_list_unittests_arm64"
156+
]
157+
}
158+
},
159+
{
160+
"name": "impeller_golden_tests_arm64",
161+
"pattern": "../out/host_debug_unopt_arm64/impeller_golden_tests",
162+
"runTask": {
163+
"before": [
164+
"impeller_golden_tests_arm64"
165+
]
166+
},
167+
"gtest": {
168+
"prependTestRunningArgs": [
169+
"--working_dir=~/Desktop"
170+
],
171+
"prependTestListingArgs": [
172+
"--working_dir=~/Desktop"
173+
]
174+
}
147175
}
148176
],
149177
"testMate.cpp.debug.configTemplate": {
@@ -161,7 +189,7 @@
161189
"text": "settings set target.source-map \"flutter/\" \"${workspaceFolder}\"",
162190
"ignoreFailures": false
163191
}
164-
],
192+
]
165193
},
166194
"win32": {
167195
"type": "cppvsdbg"
@@ -171,7 +199,7 @@
171199
"cwd": "${cwd}",
172200
"env": "${envObj}",
173201
"environment": "${envObjArray}",
174-
"sourceFileMap": "${sourceFileMapObj}",
202+
"sourceFileMap": "${sourceFileMapObj}"
175203
}
176204
},
177205
"tasks": {
@@ -195,44 +223,137 @@
195223
],
196224
"presentation": {
197225
"echo": true,
198-
"reveal": "always",
226+
"reveal": "silent",
199227
"focus": false,
200228
"panel": "shared",
201229
"clear": true
202230
},
203231
"group": {
204-
"kind": "build",
232+
"kind": "build"
205233
}
234+
},
235+
{
236+
"type": "shell",
237+
"command": "./flutter/bin/et",
238+
"options": {
239+
"cwd": "${workspaceFolder}/.."
240+
},
241+
"problemMatcher": [
242+
"$gcc"
243+
],
244+
"presentation": {
245+
"echo": true,
246+
"reveal": "silent",
247+
"focus": false,
248+
"panel": "shared",
249+
"clear": true
250+
},
251+
"group": {
252+
"kind": "build"
253+
},
254+
"label": "display_list_unittests_arm64",
255+
"args": [
256+
"build",
257+
"-c",
258+
"host_debug_unopt_arm64",
259+
"//flutter/display_list:display_list_unittests"
260+
]
261+
},
262+
{
263+
"type": "shell",
264+
"command": "./flutter/bin/et",
265+
"options": {
266+
"cwd": "${workspaceFolder}/.."
267+
},
268+
"problemMatcher": [
269+
"$gcc"
270+
],
271+
"presentation": {
272+
"echo": true,
273+
"reveal": "silent",
274+
"focus": false,
275+
"panel": "shared",
276+
"clear": true
277+
},
278+
"group": {
279+
"kind": "build"
280+
},
281+
"label": "impeller_golden_tests_arm64",
282+
"args": [
283+
"build",
284+
"-c",
285+
"host_debug_unopt_arm64",
286+
"//flutter/impeller/golden_tests:impeller_golden_tests"
287+
]
206288
}
207289
]
208290
},
209291
"extensions": {
210292
"recommendations": [
211-
// C++ TestMate
212293
"matepek.vscode-catch2-test-adapter",
213-
// Uses github-styled markdown preview, which supports more features than the default markdown preview.
214294
"bierner.github-markdown-preview",
215-
// Flutter and Dart extensions.
216295
"Dart-Code.dart-code",
217-
// Supports C/C++ in the engine.
218-
// See https://github.com/flutter/engine/blob/main/docs/contributing/Setting-up-the-Engine-development-environment.md#vscode-with-cc-intellisense-cc
219296
"llvm-vs-code-extensions.vscode-clangd",
220-
// Auto-formats C/C++ code.
221-
// https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#cc
222-
"xaver.clang-format",
297+
"xaver.clang-format"
223298
]
224299
},
225300
"launch": {
226301
"version": "0.2.0",
227302
"configurations": [
228303
{
229-
"name": "impeller_unittests_arm64",
304+
"name": "display_list_unittests_arm64",
230305
"type": "cppdbg",
231306
"request": "launch",
307+
"program": "${workspaceFolder}/../out/host_debug_unopt_arm64/display_list_unittests",
308+
"stopAtEntry": false,
309+
"cwd": "${workspaceFolder}/../out/host_debug_unopt_arm64",
310+
"environment": [],
311+
"externalConsole": false,
312+
"MIMode": "lldb",
313+
"setupCommands": [
314+
{
315+
"description": "Enable pretty-printing for lldb",
316+
"text": "settings set target.pretty-printing true",
317+
"ignoreFailures": true
318+
},
319+
{
320+
"description": "Source map",
321+
"text": "settings set target.source-map \"flutter/\" \"${workspaceFolder}\"",
322+
"ignoreFailures": false
323+
}
324+
],
325+
"preLaunchTask": "display_list_unittests_arm64"
326+
},
327+
{
328+
"type": "cppdbg",
329+
"request": "launch",
330+
"stopAtEntry": false,
331+
"cwd": "${workspaceFolder}/../out/host_debug_unopt_arm64",
332+
"environment": [],
333+
"externalConsole": false,
334+
"MIMode": "lldb",
335+
"setupCommands": [
336+
{
337+
"description": "Enable pretty-printing for lldb",
338+
"text": "settings set target.pretty-printing true",
339+
"ignoreFailures": true
340+
},
341+
{
342+
"description": "Source map",
343+
"text": "settings set target.source-map \"flutter/\" \"${workspaceFolder}\"",
344+
"ignoreFailures": false
345+
}
346+
],
347+
"name": "impeller_unittests_arm64",
232348
"program": "${workspaceFolder}/../out/host_debug_unopt_arm64/impeller_unittests",
233349
"args": [
234-
"--enable_playground",
350+
"--enable_playground"
235351
],
352+
"preLaunchTask": "impeller_unittests_arm64"
353+
},
354+
{
355+
"type": "cppdbg",
356+
"request": "launch",
236357
"stopAtEntry": false,
237358
"cwd": "${workspaceFolder}/../out/host_debug_unopt_arm64",
238359
"environment": [],
@@ -250,9 +371,14 @@
250371
"ignoreFailures": false
251372
}
252373
],
253-
"preLaunchTask": "impeller_unittests_arm64",
374+
"name": "impeller_golden_tests_arm64",
375+
"program": "${workspaceFolder}/../out/host_debug_unopt_arm64/impeller_golden_tests",
376+
"args": [
377+
"--working_dir=~/Desktop"
378+
],
379+
"preLaunchTask": "impeller_golden_tests_arm64"
254380
}
255381
],
256382
"compounds": []
257383
}
258-
}
384+
}

tools/vscode_workspace/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# VSCode Workspace
2+
3+
This is the tools and the template used for updating //engine.code-workspace.
4+
5+
VSCode uses a custom version of JSONC for their config files, those config files
6+
don't provide any mechanism for reducing redundancy. Since the engine has a lot
7+
of test targets, without that mechanism it can get very unwieldy. YAML does
8+
however support ways to reduce redundancy, namely anchors.
9+
10+
## Updating //engine.code-workspace
11+
12+
```sh
13+
./refresh.sh
14+
```
15+
16+
## Backporting //engine.code-workspace
17+
18+
If something is accidentally introduced into //engine.code-workspace without editing
19+
the YAML file here there are tools that can be used to more easily fix that.
20+
21+
```sh
22+
./merge.sh
23+
```
24+
25+
Since JSON doesn't support anchors some work may be needed to resolve any
26+
conflicts that happen when merging. These aren't necessary to use the VSCode
27+
workspace, just to edit them.
28+
29+
## Requirements
30+
31+
The `refresh.sh` and `merge.sh` tools require certain tools to be present on
32+
your PATH. They can be installed on macos with homebrew.
33+
34+
- `json5` - A variant of JSON that is a superset of the JSON variant that VSCode
35+
uses. It's used to strip away comments and trailing commas.
36+
- `yq` - This is a tool for manipulating yaml files. It can convert back and
37+
forth from YAML to YAML and merge YAML files.

0 commit comments

Comments
 (0)