diff --git a/.vscode/launch.json b/.vscode/launch.json index edb8a9ac4..4ba261df0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,7 +8,7 @@ "justMyCode": false, "stopAtEntry": true, "program": "${workspaceRoot}/debug/pwsh", - "preLaunchTask": "build", + "preLaunchTask": "Build", "externalConsole": true, "cwd": "${workspaceRoot}" }, diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 38146cfc4..4283a9f10 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -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" } ] diff --git a/build.psm1 b/build.psm1 index 14f810f3a..fdc99f976 100644 --- a/build.psm1 +++ b/build.psm1 @@ -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 }