Made YAML version of vscode workspace to avoid redundancy (flutter/engine#55322)
In https://github.com/flutter/engine/pull/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
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// Don't edit directly, see //tools/vscode_workspace for a script
|
||||
// that can refresh this from yaml.
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
@@ -126,7 +128,7 @@
|
||||
"C_Cpp.default.includePath": [
|
||||
"${default}",
|
||||
"${workspaceFolder}/..",
|
||||
"${workspaceFolder}",
|
||||
"${workspaceFolder}"
|
||||
],
|
||||
"dotnet.defaultSolution": "disable",
|
||||
"dart.showTodos": false,
|
||||
@@ -144,6 +146,32 @@
|
||||
"--enable_playground"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "display_list_unittests_arm64",
|
||||
"pattern": "../out/host_debug_unopt_arm64/display_list_unittests",
|
||||
"runTask": {
|
||||
"before": [
|
||||
"display_list_unittests_arm64"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "impeller_golden_tests_arm64",
|
||||
"pattern": "../out/host_debug_unopt_arm64/impeller_golden_tests",
|
||||
"runTask": {
|
||||
"before": [
|
||||
"impeller_golden_tests_arm64"
|
||||
]
|
||||
},
|
||||
"gtest": {
|
||||
"prependTestRunningArgs": [
|
||||
"--working_dir=~/Desktop"
|
||||
],
|
||||
"prependTestListingArgs": [
|
||||
"--working_dir=~/Desktop"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"testMate.cpp.debug.configTemplate": {
|
||||
@@ -161,7 +189,7 @@
|
||||
"text": "settings set target.source-map \"flutter/\" \"${workspaceFolder}\"",
|
||||
"ignoreFailures": false
|
||||
}
|
||||
],
|
||||
]
|
||||
},
|
||||
"win32": {
|
||||
"type": "cppvsdbg"
|
||||
@@ -171,7 +199,7 @@
|
||||
"cwd": "${cwd}",
|
||||
"env": "${envObj}",
|
||||
"environment": "${envObjArray}",
|
||||
"sourceFileMap": "${sourceFileMapObj}",
|
||||
"sourceFileMap": "${sourceFileMapObj}"
|
||||
}
|
||||
},
|
||||
"tasks": {
|
||||
@@ -195,44 +223,88 @@
|
||||
],
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "always",
|
||||
"reveal": "silent",
|
||||
"focus": false,
|
||||
"panel": "shared",
|
||||
"clear": true
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"kind": "build"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"command": "./flutter/bin/et",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/.."
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "silent",
|
||||
"focus": false,
|
||||
"panel": "shared",
|
||||
"clear": true
|
||||
},
|
||||
"group": {
|
||||
"kind": "build"
|
||||
},
|
||||
"label": "display_list_unittests_arm64",
|
||||
"args": [
|
||||
"build",
|
||||
"-c",
|
||||
"host_debug_unopt_arm64",
|
||||
"//flutter/display_list:display_list_unittests"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"command": "./flutter/bin/et",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/.."
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "silent",
|
||||
"focus": false,
|
||||
"panel": "shared",
|
||||
"clear": true
|
||||
},
|
||||
"group": {
|
||||
"kind": "build"
|
||||
},
|
||||
"label": "impeller_golden_tests_arm64",
|
||||
"args": [
|
||||
"build",
|
||||
"-c",
|
||||
"host_debug_unopt_arm64",
|
||||
"//flutter/impeller/golden_tests:impeller_golden_tests"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"extensions": {
|
||||
"recommendations": [
|
||||
// C++ TestMate
|
||||
"matepek.vscode-catch2-test-adapter",
|
||||
// Uses github-styled markdown preview, which supports more features than the default markdown preview.
|
||||
"bierner.github-markdown-preview",
|
||||
// Flutter and Dart extensions.
|
||||
"Dart-Code.dart-code",
|
||||
// Supports C/C++ in the engine.
|
||||
// See https://github.com/flutter/engine/blob/main/docs/contributing/Setting-up-the-Engine-development-environment.md#vscode-with-cc-intellisense-cc
|
||||
"llvm-vs-code-extensions.vscode-clangd",
|
||||
// Auto-formats C/C++ code.
|
||||
// https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#cc
|
||||
"xaver.clang-format",
|
||||
"xaver.clang-format"
|
||||
]
|
||||
},
|
||||
"launch": {
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "impeller_unittests_arm64",
|
||||
"name": "display_list_unittests_arm64",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/../out/host_debug_unopt_arm64/impeller_unittests",
|
||||
"args": [
|
||||
"--enable_playground",
|
||||
],
|
||||
"program": "${workspaceFolder}/../out/host_debug_unopt_arm64/display_list_unittests",
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}/../out/host_debug_unopt_arm64",
|
||||
"environment": [],
|
||||
@@ -250,9 +322,63 @@
|
||||
"ignoreFailures": false
|
||||
}
|
||||
],
|
||||
"preLaunchTask": "impeller_unittests_arm64",
|
||||
"preLaunchTask": "display_list_unittests_arm64"
|
||||
},
|
||||
{
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}/../out/host_debug_unopt_arm64",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "lldb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for lldb",
|
||||
"text": "settings set target.pretty-printing true",
|
||||
"ignoreFailures": true
|
||||
},
|
||||
{
|
||||
"description": "Source map",
|
||||
"text": "settings set target.source-map \"flutter/\" \"${workspaceFolder}\"",
|
||||
"ignoreFailures": false
|
||||
}
|
||||
],
|
||||
"name": "impeller_unittests_arm64",
|
||||
"program": "${workspaceFolder}/../out/host_debug_unopt_arm64/impeller_unittests",
|
||||
"args": [
|
||||
"--enable_playground"
|
||||
],
|
||||
"preLaunchTask": "impeller_unittests_arm64"
|
||||
},
|
||||
{
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}/../out/host_debug_unopt_arm64",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "lldb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for lldb",
|
||||
"text": "settings set target.pretty-printing true",
|
||||
"ignoreFailures": true
|
||||
},
|
||||
{
|
||||
"description": "Source map",
|
||||
"text": "settings set target.source-map \"flutter/\" \"${workspaceFolder}\"",
|
||||
"ignoreFailures": false
|
||||
}
|
||||
],
|
||||
"name": "impeller_golden_tests_arm64",
|
||||
"program": "${workspaceFolder}/../out/host_debug_unopt_arm64/impeller_golden_tests",
|
||||
"args": [
|
||||
"--working_dir=~/Desktop"
|
||||
],
|
||||
"preLaunchTask": "impeller_golden_tests_arm64"
|
||||
}
|
||||
],
|
||||
"compounds": []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
37
engine/src/flutter/tools/vscode_workspace/README.md
Normal file
37
engine/src/flutter/tools/vscode_workspace/README.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# VSCode Workspace
|
||||
|
||||
This is the tools and the template used for updating //engine.code-workspace.
|
||||
|
||||
VSCode uses a custom version of JSONC for their config files, those config files
|
||||
don't provide any mechanism for reducing redundancy. Since the engine has a lot
|
||||
of test targets, without that mechanism it can get very unwieldy. YAML does
|
||||
however support ways to reduce redundancy, namely anchors.
|
||||
|
||||
## Updating //engine.code-workspace
|
||||
|
||||
```sh
|
||||
./refresh.sh
|
||||
```
|
||||
|
||||
## Backporting //engine.code-workspace
|
||||
|
||||
If something is accidentally introduced into //engine.code-workspace without editing
|
||||
the YAML file here there are tools that can be used to more easily fix that.
|
||||
|
||||
```sh
|
||||
./merge.sh
|
||||
```
|
||||
|
||||
Since JSON doesn't support anchors some work may be needed to resolve any
|
||||
conflicts that happen when merging. These aren't necessary to use the VSCode
|
||||
workspace, just to edit them.
|
||||
|
||||
## Requirements
|
||||
|
||||
The `refresh.sh` and `merge.sh` tools require certain tools to be present on
|
||||
your PATH. They can be installed on macos with homebrew.
|
||||
|
||||
- `json5` - A variant of JSON that is a superset of the JSON variant that VSCode
|
||||
uses. It's used to strip away comments and trailing commas.
|
||||
- `yq` - This is a tool for manipulating yaml files. It can convert back and
|
||||
forth from YAML to YAML and merge YAML files.
|
||||
267
engine/src/flutter/tools/vscode_workspace/engine-workspace.yaml
Normal file
267
engine/src/flutter/tools/vscode_workspace/engine-workspace.yaml
Normal file
@@ -0,0 +1,267 @@
|
||||
folders:
|
||||
- path: .
|
||||
settings:
|
||||
files.associations:
|
||||
optional: cpp
|
||||
__bit_reference: cpp
|
||||
__bits: cpp
|
||||
__config: cpp
|
||||
__debug: cpp
|
||||
__errc: cpp
|
||||
__hash_table: cpp
|
||||
__locale: cpp
|
||||
__mutex_base: cpp
|
||||
__node_handle: cpp
|
||||
__nullptr: cpp
|
||||
__split_buffer: cpp
|
||||
__string: cpp
|
||||
__threading_support: cpp
|
||||
__tree: cpp
|
||||
__tuple: cpp
|
||||
any: cpp
|
||||
array: cpp
|
||||
atomic: cpp
|
||||
bitset: cpp
|
||||
cctype: cpp
|
||||
chrono: cpp
|
||||
cinttypes: cpp
|
||||
clocale: cpp
|
||||
cmath: cpp
|
||||
codecvt: cpp
|
||||
compare: cpp
|
||||
complex: cpp
|
||||
concepts: cpp
|
||||
condition_variable: cpp
|
||||
csignal: cpp
|
||||
cstdarg: cpp
|
||||
cstddef: cpp
|
||||
cstdint: cpp
|
||||
cstdio: cpp
|
||||
cstdlib: cpp
|
||||
cstring: cpp
|
||||
ctime: cpp
|
||||
cwchar: cpp
|
||||
cwctype: cpp
|
||||
deque: cpp
|
||||
exception: cpp
|
||||
forward_list: cpp
|
||||
fstream: cpp
|
||||
future: cpp
|
||||
initializer_list: cpp
|
||||
iomanip: cpp
|
||||
ios: cpp
|
||||
iosfwd: cpp
|
||||
iostream: cpp
|
||||
istream: cpp
|
||||
limits: cpp
|
||||
list: cpp
|
||||
locale: cpp
|
||||
map: cpp
|
||||
memory: cpp
|
||||
mutex: cpp
|
||||
new: cpp
|
||||
numeric: cpp
|
||||
ostream: cpp
|
||||
queue: cpp
|
||||
random: cpp
|
||||
ratio: cpp
|
||||
regex: cpp
|
||||
set: cpp
|
||||
span: cpp
|
||||
sstream: cpp
|
||||
stack: cpp
|
||||
stdexcept: cpp
|
||||
streambuf: cpp
|
||||
string: cpp
|
||||
string_view: cpp
|
||||
strstream: cpp
|
||||
system_error: cpp
|
||||
tuple: cpp
|
||||
type_traits: cpp
|
||||
typeinfo: cpp
|
||||
unordered_map: cpp
|
||||
unordered_set: cpp
|
||||
valarray: cpp
|
||||
variant: cpp
|
||||
vector: cpp
|
||||
algorithm: cpp
|
||||
filesystem: cpp
|
||||
memory_resource: cpp
|
||||
bit: cpp
|
||||
charconv: cpp
|
||||
format: cpp
|
||||
functional: cpp
|
||||
iterator: cpp
|
||||
utility: cpp
|
||||
__assert: cpp
|
||||
'*.inc': cpp
|
||||
__verbose_abort: cpp
|
||||
'*.def': cpp
|
||||
'*.hpp11': cpp
|
||||
__functional_base: cpp
|
||||
shared_mutex: cpp
|
||||
coroutine: cpp
|
||||
hash_map: cpp
|
||||
hash_set: cpp
|
||||
thread: cpp
|
||||
propagate_const: cpp
|
||||
'*.gen': cpp
|
||||
simd: cpp
|
||||
barrier: cpp
|
||||
cuchar: cpp
|
||||
latch: cpp
|
||||
numbers: cpp
|
||||
scoped_allocator: cpp
|
||||
semaphore: cpp
|
||||
typeindex: cpp
|
||||
__std_stream: cpp
|
||||
'*.ipp': cpp
|
||||
csetjmp: cpp
|
||||
cfenv: cpp
|
||||
C_Cpp.default.includePath:
|
||||
- ${default}
|
||||
- ${workspaceFolder}/..
|
||||
- ${workspaceFolder}
|
||||
dotnet.defaultSolution: disable
|
||||
dart.showTodos: false
|
||||
testMate.cpp.test.advancedExecutables:
|
||||
- name: impeller_unittests_arm64
|
||||
pattern: ../out/host_debug_unopt_arm64/impeller_unittests
|
||||
runTask:
|
||||
before:
|
||||
- impeller_unittests_arm64
|
||||
gtest:
|
||||
prependTestRunningArgs:
|
||||
- --enable_playground
|
||||
- name: display_list_unittests_arm64
|
||||
pattern: ../out/host_debug_unopt_arm64/display_list_unittests
|
||||
runTask:
|
||||
before:
|
||||
- display_list_unittests_arm64
|
||||
- name: impeller_golden_tests_arm64
|
||||
pattern: ../out/host_debug_unopt_arm64/impeller_golden_tests
|
||||
runTask:
|
||||
before:
|
||||
- impeller_golden_tests_arm64
|
||||
gtest:
|
||||
prependTestRunningArgs:
|
||||
- &golden-workspace --working_dir=~/Desktop
|
||||
prependTestListingArgs:
|
||||
- *golden-workspace
|
||||
testMate.cpp.debug.configTemplate:
|
||||
type: cppvsdbg
|
||||
linux:
|
||||
type: cppdbg
|
||||
MIMode: gdb
|
||||
darwin:
|
||||
type: cppdbg
|
||||
MIMode: lldb
|
||||
setupCommands:
|
||||
- description: Source map
|
||||
text: &source-map-cmd settings set target.source-map "flutter/" "${workspaceFolder}"
|
||||
ignoreFailures: false
|
||||
win32:
|
||||
type: cppvsdbg
|
||||
program: ${exec}
|
||||
args: ${argsArray}
|
||||
cwd: ${cwd}
|
||||
env: ${envObj}
|
||||
environment: ${envObjArray}
|
||||
sourceFileMap: ${sourceFileMapObj}
|
||||
tasks:
|
||||
version: 2.0.0
|
||||
tasks:
|
||||
- &et-task
|
||||
label: impeller_unittests_arm64
|
||||
type: shell
|
||||
command: &et-cmd ./flutter/bin/et
|
||||
args:
|
||||
- build
|
||||
- -c
|
||||
- host_debug_unopt_arm64
|
||||
- //flutter/impeller:impeller_unittests
|
||||
options:
|
||||
cwd: ${workspaceFolder}/..
|
||||
problemMatcher:
|
||||
- $gcc
|
||||
presentation:
|
||||
echo: true
|
||||
reveal: silent
|
||||
focus: false
|
||||
panel: shared
|
||||
clear: true
|
||||
group:
|
||||
kind: build
|
||||
- <<: *et-task
|
||||
label: display_list_unittests_arm64
|
||||
args:
|
||||
- build
|
||||
- -c
|
||||
- host_debug_unopt_arm64
|
||||
- //flutter/display_list:display_list_unittests
|
||||
- <<: *et-task
|
||||
label: impeller_golden_tests_arm64
|
||||
args:
|
||||
- build
|
||||
- -c
|
||||
- host_debug_unopt_arm64
|
||||
- //flutter/impeller/golden_tests:impeller_golden_tests
|
||||
- <<: *et-task
|
||||
label: ios_debug_unopt_arm64
|
||||
args:
|
||||
- build
|
||||
- -c
|
||||
- host_debug_unopt_arm64
|
||||
- "&&"
|
||||
- *et-cmd
|
||||
- build
|
||||
- -c
|
||||
- ios_debug_unopt
|
||||
extensions:
|
||||
recommendations:
|
||||
# C++ TestMate
|
||||
- matepek.vscode-catch2-test-adapter
|
||||
# Uses github-styled markdown preview, which supports more features than the default markdown preview.
|
||||
- bierner.github-markdown-preview
|
||||
# Flutter and Dart extensions.
|
||||
- Dart-Code.dart-code
|
||||
# Supports C/C++ in the engine.
|
||||
# See https://github.com/flutter/engine/blob/main/docs/contributing/Setting-up-the-Engine-development-environment.md#vscode-with-cc-intellisense-cc
|
||||
- llvm-vs-code-extensions.vscode-clangd
|
||||
# Auto-formats C/C++ code.
|
||||
# https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#cc
|
||||
- xaver.clang-format
|
||||
launch:
|
||||
version: 0.2.0
|
||||
configurations:
|
||||
- &launch
|
||||
name: display_list_unittests_arm64
|
||||
type: cppdbg
|
||||
request: launch
|
||||
program: ${workspaceFolder}/../out/host_debug_unopt_arm64/display_list_unittests
|
||||
stopAtEntry: false
|
||||
cwd: ${workspaceFolder}/../out/host_debug_unopt_arm64
|
||||
environment: []
|
||||
externalConsole: false
|
||||
MIMode: lldb
|
||||
setupCommands:
|
||||
- description: Enable pretty-printing for lldb
|
||||
text: settings set target.pretty-printing true
|
||||
ignoreFailures: true
|
||||
- description: Source map
|
||||
text: *source-map-cmd
|
||||
ignoreFailures: false
|
||||
preLaunchTask: display_list_unittests_arm64
|
||||
- <<: *launch
|
||||
name: impeller_unittests_arm64
|
||||
program: ${workspaceFolder}/../out/host_debug_unopt_arm64/impeller_unittests
|
||||
args:
|
||||
- --enable_playground
|
||||
preLaunchTask: impeller_unittests_arm64
|
||||
- <<: *launch
|
||||
name: impeller_golden_tests_arm64
|
||||
program: ${workspaceFolder}/../out/host_debug_unopt_arm64/impeller_golden_tests
|
||||
args:
|
||||
- *golden-workspace
|
||||
preLaunchTask: impeller_golden_tests_arm64
|
||||
compounds: []
|
||||
11
engine/src/flutter/tools/vscode_workspace/merge.sh
Executable file
11
engine/src/flutter/tools/vscode_workspace/merge.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
WORKSPACE=../../engine.code-workspace
|
||||
cleaned_temp_file=$(mktemp)
|
||||
json5 "$WORKSPACE" -s 2 -o "$cleaned_temp_file"
|
||||
yaml_temp_file=$(mktemp)
|
||||
yq eval -P "$cleaned_temp_file" > "$yaml_temp_file"
|
||||
merged_temp_file=$(mktemp)
|
||||
yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' \
|
||||
"$yaml_temp_file" engine-workspace.yaml > "$merged_temp_file" && \
|
||||
mv "$merged_temp_file" engine-workspace.yaml
|
||||
rm "$yaml_temp_file"
|
||||
rm "$cleaned_temp_file"
|
||||
6
engine/src/flutter/tools/vscode_workspace/refresh.sh
Executable file
6
engine/src/flutter/tools/vscode_workspace/refresh.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
WORKSPACE=../../engine.code-workspace
|
||||
# json5 "$WORKSPACE" -s 2 -o engine.code-workspace
|
||||
# yq eval -P engine.code-workspace > engine-workspace.yaml
|
||||
yq eval -o=json engine-workspace.yaml > "$WORKSPACE"
|
||||
temp_file=$(mktemp)
|
||||
{ echo "// Don't edit directly, see //tools/vscode_workspace for a script"; echo "// that can refresh this from yaml."; cat "$WORKSPACE"; } > "$temp_file" && mv "$temp_file" "$WORKSPACE"
|
||||
Reference in New Issue
Block a user