From bc7bbc25a886a4ee895c943c32b6e7c1adbbd922 Mon Sep 17 00:00:00 2001 From: "Sergey S. Betke" Date: Tue, 19 Jun 2018 15:08:31 +0300 Subject: [PATCH] =?UTF-8?q?*=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20problemMatcher=20=D0=B4=D0=BB=D1=8F=20=D0=BE=D1=88?= =?UTF-8?q?=D0=B8=D0=B1=D0=BE=D0=BA=20make=20(Metrolog/marks#49)=20[ci=20s?= =?UTF-8?q?kip]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/Resolve-PathInGNUMakeLog.ps1 | 44 +++++++++++++++++++++ .vscode/tasks.json | 58 ++++++++++++++++++---------- 2 files changed, 82 insertions(+), 20 deletions(-) create mode 100644 .vscode/Resolve-PathInGNUMakeLog.ps1 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",