diff --git a/.vscode/Resolve-PathInGNUMakeLog.ps1 b/.vscode/Resolve-PathInGNUMakeLog.ps1 new file mode 100644 index 00000000..ae390dc3 --- /dev/null +++ b/.vscode/Resolve-PathInGNUMakeLog.ps1 @@ -0,0 +1,44 @@ +<# +.Synopsis + Преобразует относительные имена файлов в выводе GNU Make в абсолютные. +.Description + Преобразует относительные имена файлов в выводе GNU Make в абсолютные. +.Example + make 2>&1 | .\.vscode\Resolve-PathInGNUMakeLog.ps1; +#> +[CmdletBinding( + SupportsShouldProcess = $false +)] + +param ( + # Строка вывода GNU Make. + [Parameter( + Mandatory = $true + , ValueFromPipeline = $true + )] + [ValidateNotNull()] + [Alias('GNUMakeOutput')] + [String] + $InputObject +) + +process { + $ErrorActionPreference = 'Continue'; + Switch -Regex ( $_ ) { + 'make(?:\.exe)?\s+.*?-C\s+(?\S+)' { + Push-Location $Matches['subDir']; + $_ + } + '^make\[\d+\]: Leaving directory ''(?.+?)''' { + Pop-Location; + $_ + } + '^(.+?):(\d+):\s+(.*?) Stop.$' { + $_ -replace '^(.+?)(?=:)', "$( Join-Path (Get-Location) '$1')" + } + '^make: \*\*\* \[(?\S+?):(?\d+):\s*(.*?)\]\s+(?Error|Warning)\s+(?\d+)$' { + $_ -replace '(?<=make: \*\*\* \[)(\S+?)(?=:)', "$( Join-Path (Get-Location) '$1')" + } ` + default { $_ } + }; +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 76e45ae2..3414961f 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -17,7 +17,12 @@ { "label": "Выполнить сборку", "type": "shell", - "command": "make", + "windows": { + "command": "cmd /c 'make 2>&1' | .\\.vscode\\Resolve-PathInGNUMakeLog.ps1", + }, + "linux": { + "command": "/bin/sh -c 'make 2>&1' | .\\.vscode\\Resolve-PathInGNUMakeLog.ps1", + }, "group": { "kind": "build", "isDefault": true @@ -26,21 +31,30 @@ "reveal": "always", "panel": "shared" }, - "problemMatcher": { - "fileLocation": ["relative", "${workspaceFolder}"], - - "pattern": { - "regexp": "^([^\\s].*?):(\\d+|):\\s+(.*?) Stop.$", - "file": 1, - "line": 2, - "message": 3 + "problemMatcher": [ + { + "owner": "custom", + "fileLocation": "absolute", + "pattern": [ + { + "regexp": "^(.+?):(\\d+):\\s+(.*?) Stop\\.$", + "file": 1, + "line": 2, + "message": 3 + } + ] } - } + ] }, { "label": "Выполнить тесты", "type": "shell", - "command": "make check", + "windows": { + "command": "cmd /c 'make check 2>&1' | .\\.vscode\\Resolve-PathInGNUMakeLog.ps1", + }, + "linux": { + "command": "/bin/sh -c 'make check 2>&1' | .\\.vscode\\Resolve-PathInGNUMakeLog.ps1", + }, "group": { "kind": "test", "isDefault": true @@ -49,16 +63,20 @@ "reveal": "always", "panel": "shared" }, - "problemMatcher": { - "fileLocation": ["relative", "${workspaceFolder}"], - - "pattern": { - "regexp": "^([^\\s].*?):(\\d+|):\\s+(.*?) Stop.$", - "file": 1, - "line": 2, - "message": 3 + "problemMatcher": [ + { + "owner": "custom", + "fileLocation": "absolute", + "pattern": [ + { + "regexp": "^(.+?):(\\d+):\\s+(.*?) Stop\\.$", + "file": 1, + "line": 2, + "message": 3 + } + ] } - } + ] }, { "label": "Отправить изменения в ITG.MakeUtils",