iarsystems / iar-vsc-build

Visual Studio Code extension for developing and building IAR projects
https://marketplace.visualstudio.com/items?itemName=iarsystems.iar-build
Mozilla Public License 2.0
38 stars 5 forks source link

Export selected project as variable so it is usable in tasks. #15

Closed nxj closed 2 years ago

nxj commented 2 years ago

Similar to the current project configuration it would be great if one could use the current project as variable in the tasks. For example using ${command:iar-config.project} to access the hex file depending on the currently selected project:

{
    "label": "My Custom Task",
    "type": "process",
    "command": "test.exe",
    "args": [
        " --hex_file ${workspaceFolder}\\path\\to\\iar\\${command:iar-config.project}\\${command:iar-config.project-configuration}\\Exe\\out.hex",
    ]
}
HampusAdolfsson commented 2 years ago

Do you mean just the name of the project? Or the path to the project directory?

There is ${command:iar-config.project-file}, which gives you the full path of the .ewp file. You could do something like this:

" --hex_file ${command:iar-config.project-file}\\..\\${command:iar-config.project-configuration}\\Exe\\out.hex",
nxj commented 2 years ago

I meant the name of the project. Maybe my example was not very good. For my project, the name of the out file is also the project name so i would like to use it there too. E.g.

" --hex_file ${workspaceFolder}\\path\\to\\iar\\${command:iar-config.project}\\${command:iar-config.project-configuration}\\Exe\\${command:iar-config.project}.hex"
HampusAdolfsson commented 2 years ago

This would be useful also for writing launch.json configurations that work for multiple projects.

I've added a iar-config.project-name command that returns the name of the project. It will be available in the next update.

HampusAdolfsson commented 2 years ago

Implemented in 1.10.5