Fix build in vscode (#5453)

- Fix build in vscode
- Add v2.0.0 tasks.json thanks to Keith Hill
- Add '/property:GenerateFullPaths=true' to build to fix the $mscompile 'problem matcher' not working issue.
This commit is contained in:
Steve Lee 2017-11-15 11:40:49 -08:00 committed by Dongbo Wang
parent 019cfee82c
commit 2f8e691e05
3 changed files with 73 additions and 13 deletions

2
.vscode/launch.json vendored
View file

@ -8,7 +8,7 @@
"justMyCode": false,
"stopAtEntry": true,
"program": "${workspaceRoot}/debug/pwsh",
"preLaunchTask": "build",
"preLaunchTask": "Build",
"externalConsole": true,
"cwd": "${workspaceRoot}"
},

65
.vscode/tasks.json vendored
View file

@ -1,16 +1,63 @@
{
"version": "0.1.0",
"command": "pwsh",
"isShellCommand": true,
"showOutput": "always",
"suppressTaskName": true,
"args": [ "-command" ],
"version": "2.0.0",
"windows": {
"options": {
"shell": {
"executable": "pwsh.exe",
"args": [
"-NoProfile",
"-ExecutionPolicy",
"Bypass",
"-Command"
]
}
}
},
"linux": {
"options": {
"shell": {
"executable": "/usr/bin/pwsh",
"args": [
"-NoProfile",
"-Command"
]
}
}
},
"osx": {
"options": {
"shell": {
"executable": "/usr/local/bin/pwsh",
"args": [
"-NoProfile",
"-Command"
]
}
}
},
"tasks": [
{
"taskName": "build",
"args": [ "Import-Module ${workspaceRoot}/build.psm1; Start-PSBuild -Output ${workspaceRoot}/debug" ],
"isBuildCommand": true,
"label": "Bootstrap",
"type": "shell",
"command": "Import-Module ${workspaceFolder}/build.psm1; Start-PSBootstrap",
"problemMatcher": []
},
{
"label": "Clean Build",
"type": "shell",
"command": "Import-Module ${workspaceFolder}/build.psm1; Start-PSBuild -Clean -Output (Join-Path ${workspaceFolder} debug)",
"problemMatcher": "$msCompile"
},
{
"label": "Build",
"type": "shell",
"command": "Import-Module ${workspaceFolder}/build.psm1; Start-PSBuild -Output (Join-Path ${workspaceFolder} debug)",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$msCompile"
}
]

View file

@ -462,7 +462,7 @@ Fix steps:
}
# setup arguments
$Arguments = @("publish")
$Arguments = @("publish","/property:GenerateFullPaths=true")
if ($Output) {
$Arguments += "--output", $Output
}
@ -573,9 +573,22 @@ Fix steps:
} else {
$ReleaseVersion = (Get-PSCommitId -WarningAction SilentlyContinue) -replace '^v'
}
# in VSCode, depending on where you started it from, the git commit id may be empty so provide a default value
if (!$ReleaseVersion) {
$ReleaseVersion = "6.0.0"
$fileVersion = "6.0.0"
} else {
$fileVersion = $ReleaseVersion.Split("-")[0]
}
Start-NativeExecution { & "~/.rcedit/rcedit-x64.exe" "$($Options.Output)" --set-icon "$PSScriptRoot\assets\Powershell_black.ico" `
--set-file-version $ReleaseVersion --set-product-version $ReleaseVersion --set-version-string "ProductName" "PowerShell Core 6" `
# in VSCode, the build output folder doesn't include the name of the exe so we have to add it for rcedit
$pwshPath = $Options.Output
if (!$pwshPath.EndsWith("pwsh.exe")) {
$pwshPath = Join-Path $Options.Output "pwsh.exe"
}
Start-NativeExecution { & "~/.rcedit/rcedit-x64.exe" $pwshPath --set-icon "$PSScriptRoot\assets\Powershell_black.ico" `
--set-file-version $fileVersion --set-product-version $ReleaseVersion --set-version-string "ProductName" "PowerShell Core 6" `
--set-requested-execution-level "asInvoker" --set-version-string "LegalCopyright" "(C) Microsoft Corporation. All Rights Reserved." } | Write-Verbose
}