Working with tasks
You can launch and configure tasks to automate the steps when running your project's tools and scripts.
Launching a task
Tasks in Visual Studio Code define a sequence of steps that can help you build, package, and test your projects.
To launch a task:
- Go to Terminal > Run Task... from the menu bar, as shown in the
image below:
- Select the task you want to run:
Refer to the VS Code documentation to learn more about integrating with external tools via tasks: https://code.visualstudio.com/docs/editor/tasks.
Configuring tasks
You can use VS Code to configure tasks to run your project's tools or scripts without having to use the command line.
To configure tasks:
- Go to Terminal > Configure Task... from the menu bar.
- Select the task you want to configure.
Accessing remote targets
You can use the qnx-shell task to transfer a list of files to a target automatically, as part of your workflow in VS Code. Refer to the examples below.
Example 1:
This task copies files from the current workspace folder to the /tmp directory on the default target:
{
"label": "Copy file to target",
"type": "qnx-shell",
"command": "upload",
"args": [
"--chmod=777",
"nto/x86_64/o/xxx",
"/tmp/"
]
},
Example 2:
This task copies files from the target to the host.
{
"label": "Copy from target",
"type": "qnx-shell",
"command": "download",
"qnxtarget": "honey.bbq.net",
"args": [
"/tmp/result.log",
"${workspaceFolder}/result.log",
]
},
Example 3:
This task launches /tmp/xxx and redirects input, output, or both to the task console passing myarg as an argument.
{
"label": "Target launch",
"type": "qnx-shell",
"command": "exec",
"args": [
"/tmp/xxx",
"myarg",
]
},
Example 4:
This task runs on the target and then proceeds to copy the generated file back to the host. In this example, the tracelogger runs for three seconds and saves its output to /tmp/trace.kev (for options, refer to the entry for tracelogger in the QNX Neutrino C Library Reference). Once the execution is completed, the tracelogger downloads the generated file from the specified target location back to the host workspace.
{
"type": "qnx-gdb",
"request": "launch",
"name": "tracelogger",
"gdb": "none",
"program": "tracelogger",
"args": [
"-s3",
"-f/tmp/trace.kev"
],
"qnxtarget": "default",
"upload": false,
"files": [
{
"operation": "download",
"remotePath": "trace.kev"
}
]
},