Commit b426cf9b authored by Dan Harrington's avatar Dan Harrington Committed by Commit Bot

Update example vscode tasks

- Try to make the tasks more general purpose.
  * Add mechanism to switch output directories. Most
    tasks will work with this value.
  * Add tasks to run tests for the current file or directory
    instead of pre-determined targets.
- Try to simplify it.
  * Remove some parameters which are defaults
  * Move pattern matches to top-level, to avoid duplicates.

Change-Id: Ifff15bc264be510c0859e4adcce7b996349ac343
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2402189Reviewed-by: default avatarChase Phillips <cmp@chromium.org>
Commit-Queue: Chase Phillips <cmp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805872}
parent 8d80e246
...@@ -259,12 +259,12 @@ in the Explorer tab) is chromium/src. If this is not the case, replace any ...@@ -259,12 +259,12 @@ in the Explorer tab) is chromium/src. If this is not the case, replace any
references to ${workspaceFolder} with the path to chromium/src. references to ${workspaceFolder} with the path to chromium/src.
### Tasks ### Tasks
Next, we'll tell VS Code how to compile our code and how to read warnings and Next, we'll tell VS Code how to compile our code, run tests, and to read
errors from the build output. Open the file warnings and errors from the build output. Open the file
[//tools/vscode/tasks.json5](/tools/vscode/tasks.json5). This will provide 5 [//tools/vscode/tasks.json5](/tools/vscode/tasks.json5). This will provide tasks
tasks to do basic things. You might have to adjust the commands to your to do basic things. You might have to adjust the commands to your situation and
situation and needs. To use these settings wholesale, enter the following needs. To use these settings wholesale, enter the following command into your
command into your terminal: terminal:
``` ```
$ cp tools/vscode/tasks.json5 .vscode/tasks.json $ cp tools/vscode/tasks.json5 .vscode/tasks.json
``` ```
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"targetArchitecture": "x64", "targetArchitecture": "x64",
"program": "${workspaceRoot}/out/Debug/chrome", "program": "${workspaceRoot}/out/Debug/chrome",
"args": [], // Optional command line args "args": [], // Optional command line args
"preLaunchTask": "1-build_chrome_debug", "preLaunchTask": "6-build_chrome_debug",
"stopAtEntry": false, "stopAtEntry": false,
"cwd": "${workspaceRoot}/out/Debug/", "cwd": "${workspaceRoot}/out/Debug/",
"environment": [], "environment": [],
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
"targetArchitecture": "x64", "targetArchitecture": "x64",
"program": "${workspaceRoot}/out/Release/chrome", "program": "${workspaceRoot}/out/Release/chrome",
"args": [], // Optional command line args "args": [], // Optional command line args
"preLaunchTask": "2-build_chrome_release", "preLaunchTask": "7-build_chrome_release",
"stopAtEntry": false, "stopAtEntry": false,
"cwd": "${workspaceRoot}/out/Release/", "cwd": "${workspaceRoot}/out/Release/",
"environment": [], "environment": [],
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
"--ui-test-action-max-timeout=1000000", "--ui-test-action-max-timeout=1000000",
"--test-launcher-timeout=1000000" "--test-launcher-timeout=1000000"
], ],
"preLaunchTask": "5-build_test_debug", "preLaunchTask": "8-build_test_debug",
"stopAtEntry": false, "stopAtEntry": false,
"cwd": "${workspaceRoot}/out/Debug/", "cwd": "${workspaceRoot}/out/Debug/",
"environment": [], "environment": [],
......
{ {
// Note!
// You can set the value used for ${config:chrome.outputDir} in your settings.json
// file with a line like:
// "chrome.outputDir": "/path/to/chromium/src/out/Debug",
"version": "2.0.0", "version": "2.0.0",
"runner": "terminal", "runner": "terminal",
"tasks": [ // The default problem matcher matches build output, which is useful for most tasks.
{ "problemMatcher": [
"label": "1-build_chrome_debug",
"type": "shell",
"command": "autoninja -C out/Debug chrome",
"group": "test",
"presentation": {
"echo": true,
"reveal": "always"
},
"problemMatcher": [
{
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}/out/Debug"],
"pattern": {
"regexp": "^(gen/.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
}
},
{
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
}
},
{
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}/out/Debug"],
"pattern": {
"regexp": "^(gen/.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "severity": 3, "message": 4
}
},
{
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "severity": 3, "message": 4
}
}]
},
{
"label": "2-build_chrome_release",
"type": "shell",
"command": "ninja -C out/Release -j 2000 chrome",
"group": "build",
"presentation": {
"echo": true,
"reveal": "always"
},
"problemMatcher": [
{
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}/out/Release"],
"pattern": {
"regexp": "^(gen/.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
}
},
{
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
}
},
{ {
"owner": "cpp", "owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}/out/Release"], "fileLocation": ["relative", "${config:chrome.outputDir}"],
"pattern": {
"regexp": "^(gen/.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "severity": 3, "message": 4
}
},
{
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "severity": 3, "message": 4
}
}]
},
{
"label": "3-build_all_debug",
"type": "shell",
"command": "autoninja -C out/Debug",
"presentation": {
"echo": true,
"reveal": "always"
},
"problemMatcher": [
{
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}/out/Debug"],
"pattern": { "pattern": {
"regexp": "^(gen/.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$", "regexp": "^(gen/.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
...@@ -115,7 +25,7 @@ ...@@ -115,7 +25,7 @@
}, },
{ {
"owner": "cpp", "owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}/out/Debug"], "fileLocation": ["relative", "${config:chrome.outputDir}"],
"pattern": { "pattern": {
"regexp": "^(gen/.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$", "regexp": "^(gen/.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "severity": 3, "message": 4 "file": 1, "severity": 3, "message": 4
...@@ -128,132 +38,98 @@ ...@@ -128,132 +38,98 @@
"regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$", "regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "severity": 3, "message": 4 "file": 1, "severity": 3, "message": 4
} }
}] }
],
"options": {
// It's important to set the CWD to the output directory so that file paths
// are linked correctly in the terminal output.
"cwd": "${config:chrome.outputDir}"
}, },
{
"label": "4-build_all_release", "inputs": [
"type": "shell", {
"command": "ninja -C out/Release -j 2000", // See 'Set Chrome Output Directory'.
"presentation": { "type": "pickString",
"echo": true, "id": "chromeOutputDir",
"reveal": "always" "description": "Chrome output directory:",
}, // Configure this to point to all the output directories you use.
"problemMatcher": [ "options": [
{ "/path/to/chromium/src/out/pc",
"owner": "cpp", "/path/to/chromium/src/out/Debug",
"fileLocation": ["relative", "${workspaceRoot}/out/Release"], "/path/to/chromium/src/out/Debug_x86"
"pattern": { ]
"regexp": "^(gen/.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$", }
"file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 ],
} "tasks": [
}, // Set the Chrome output directory to be used in future task runs.
// This uses a symbolic link to remember the current output directory.
// If you want to use this, make sure chrome.outputDir is configured to
// point to the link created at ${workspaceFolder}/out/current_link.
// Alternatively:
// * If you want to be prompted for the output directory each
// time you run a command, replace
// ${config:chrome.outputDir}
// with
// ${input:chromeOutputDir}
// everywhere in this file.
//
// * If you want to have different tasks for different output directories,
// just create duplicate tasks and hard-code the output directory used.
{ {
"owner": "cpp", "label": "0-set_chrome_output_directory",
"fileLocation": ["relative", "${workspaceRoot}"], "command": "rm -f ${workspaceFolder}/out/current_link; ln -s ${input:chromeOutputDir} ${workspaceFolder}/out/current_link",
"pattern": { "type": "shell",
"regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$", // The default problem matcher doesn't make sense here, so remove it.
"file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 "problemMatcher": [],
"options": {
"cwd": "${workspaceFolder}"
} }
}, },
// Some general-purpose build and test tasks. These all inherit the
// problemMatcher at the top of the file.
{ {
"owner": "cpp", "label": "1-build_chrome",
"fileLocation": ["relative", "${workspaceRoot}/out/Release"], "type": "shell",
"pattern": { "command": "autoninja -C ${config:chrome.outputDir} chrome",
"regexp": "^(gen/.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$", "group": "test"
"file": 1, "severity": 3, "message": 4
}
}, },
{ {
"owner": "cpp", "label": "2-build_all",
"fileLocation": ["relative", "${workspaceRoot}"], "type": "shell",
"pattern": { "command": "autoninja -C ${config:chrome.outputDir}"
"regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "severity": 3, "message": 4
}
}]
},
{
"label": "5-build_test_debug",
"type": "shell",
"command": "autoninja -C out/Debug unit_tests components_unittests browser_tests",
"presentation": {
"echo": true,
"reveal": "always"
}, },
"problemMatcher": [
{ {
"owner": "cpp", "label": "3-test_current_file",
"fileLocation": ["relative", "${workspaceRoot}/out/Debug"], "type": "shell",
"pattern": { "command": "${workspaceFolder}/tools/autotest.py -C ${config:chrome.outputDir} --run_all ${file}"
"regexp": "^(gen/.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
}
}, },
{ {
"owner": "cpp", "label": "4-test_current_directory",
"fileLocation": ["relative", "${workspaceRoot}"], "type": "shell",
"pattern": { "command": "${workspaceFolder}/tools/autotest.py -C ${config:chrome.outputDir} --run_all ${fileDirname}"
"regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
}
}, },
{ {
"owner": "cpp", "label": "5-build_current_file",
"fileLocation": ["relative", "${workspaceRoot}/out/Debug"], "type": "shell",
"pattern": { "command": "compile_single_file --build-dir=${config:chrome.outputDir} --file-path=${file}"
"regexp": "^(gen/.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "severity": 3, "message": 4
}
},
{
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "severity": 3, "message": 4
}
}]
},
{
"label": "6-build_current_file",
"type": "shell",
"command": "compile_single_file --build-dir=out/Debug --file-path=${file}",
"presentation": {
"echo": true,
"reveal": "always"
},
"problemMatcher": [
{
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}/out/Debug"],
"pattern": {
"regexp": "^(gen/.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
}
}, },
// Some more specific build tasks, which hard-code the output directory.
{ {
"owner": "cpp", "label": "6-build_chrome_debug",
"fileLocation": ["relative", "${workspaceRoot}"], "type": "shell",
"pattern": { "command": "autoninja -C ${workspaceFolder}/out/Debug chrome"
"regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
}
}, },
{ {
"owner": "cpp", "label": "7-build_chrome_release",
"fileLocation": ["relative", "${workspaceRoot}/out/Debug"], "type": "shell",
"pattern": { "command": "autoninja -C ${workspaceFolder}/out/Release chrome"
"regexp": "^(gen/.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
"file": 1, "severity": 3, "message": 4
}
}, },
{ {
"owner": "cpp", "label": "8-build_test_debug",
"fileLocation": ["relative", "${workspaceRoot}"], "type": "shell",
"pattern": { "command": "autoninja -C ${workspaceFolder}/out/Debug unit_tests components_unittests browser_tests"
"regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$", }
"file": 1, "severity": 3, "message": 4 ]
}
}]
}]
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment