Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix build in vscode #5453

Merged
merged 5 commits into from Nov 15, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/launch.json
Expand Up @@ -8,7 +8,7 @@
"justMyCode": false,
"stopAtEntry": true,
"program": "${workspaceRoot}/debug/pwsh",
"preLaunchTask": "build",
"preLaunchTask": "Build",
"externalConsole": true,
"cwd": "${workspaceRoot}"
},
Expand Down
67 changes: 57 additions & 10 deletions .vscode/tasks.json
@@ -1,17 +1,64 @@
{
"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",
"problemMatcher": "$msCompile"
},
{
"label": "Build",
"type": "shell",
"command": "Import-Module ${workspaceFolder}/build.psm1; Start-PSBuild -Output (Join-Path ${workspaceFolder} debug)",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Can you add the same parameter to the Clean Build task above? Also, Clean Build reads a little awkward. What if we called this task Rebuild? On VS at least, that implies Clean, then Build.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW I was just going to warn you about this issue when I saw you not only already knew about it but solved it. 👍 Also, I tagged onto this VSCode issue on the $mscompile problem matcher not working - microsoft/vscode#34660

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add to Clean Build which I think is named fine

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SteveL-MSFT I got a response from the VSCode team on the $mscompile issue. All we need to do is add the command line arg - /property:GenerateFullPaths=true. I tried putting this around line 485:

    $Arguments += "/property:GenerateFullPaths=true"

And it works! There may be other places where this arg needs to be provided.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add. Thanks!

"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$msCompile"
}
]
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will add

17 changes: 15 additions & 2 deletions build.psm1
Expand Up @@ -570,9 +570,22 @@ Fix steps:
} else {
$ReleaseVersion = (Get-PSCommitId) -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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a comment about "In vscode, depending on where you started it from, it may not get the git commit id so it ends up empty. Add a default value to use."?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

$ReleaseVersion = "6.0.0"
$fileVersion = "6.0.0"
} else {
$fileVersion = $ReleaseVersion.Split("-")[0]
}

# 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" "$($Options.Output)" --set-icon "$PSScriptRoot\assets\Powershell_black.ico" `
--set-file-version $ReleaseVersion --set-product-version $ReleaseVersion --set-version-string "ProductName" "PowerShell Core 6" `
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" `
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$fileVersion is not set when $ReleaseTagToUse exists.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix

--set-requested-execution-level "asInvoker" --set-version-string "LegalCopyright" "(C) Microsoft Corporation. All Rights Reserved." } | Write-Verbose
}

Expand Down