Merge pull request #961 from PowerShell/andschwa/output-switch

Add -Output switch to fix debug story
This commit is contained in:
Andy Schwartzmeyer 2016-05-06 12:06:29 -07:00
commit e19a1f0b3d
7 changed files with 44 additions and 21 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
bin/ bin/
obj/ obj/
debug/
project.lock.json project.lock.json
*-tests.xml *-tests.xml

4
.vscode/launch.json vendored
View file

@ -7,8 +7,8 @@
"request": "launch", "request": "launch",
"justMyCode": false, "justMyCode": false,
"stopAtEntry": true, "stopAtEntry": true,
"program": "${workspaceRoot}/bin/powershell", "program": "${workspaceRoot}/debug/powershell",
"args": [ ], "args": [ "-NonInteractive" ],
"preLaunchTask": "build", "preLaunchTask": "build",
"cwd": "${workspaceRoot}" "cwd": "${workspaceRoot}"
}, },

2
.vscode/tasks.json vendored
View file

@ -8,7 +8,7 @@
"tasks": [ "tasks": [
{ {
"taskName": "build", "taskName": "build",
"args": [ "Import-Module ${workspaceRoot}/PowerShellGitHubDev.psm1; Start-PSBuild" ], "args": [ "Import-Module ${workspaceRoot}/PowerShellGitHubDev.psm1; Start-PSBuild -Output debug" ],
"isBuildCommand": true, "isBuildCommand": true,
"problemMatcher": "$msCompile" "problemMatcher": "$msCompile"
} }

View file

@ -25,6 +25,7 @@ function Start-PSBuild {
param( param(
[switch]$NoPath, [switch]$NoPath,
[switch]$Restore, [switch]$Restore,
[string]$Output,
[Parameter(ParameterSetName='CoreCLR')] [Parameter(ParameterSetName='CoreCLR')]
[switch]$Publish, [switch]$Publish,
@ -105,7 +106,7 @@ function Start-PSBuild {
} }
# set output options # set output options
$OptionsArguments = @{Publish=$Publish; FullCLR=$FullCLR; Runtime=$Runtime} $OptionsArguments = @{Publish=$Publish; Output=$Output; FullCLR=$FullCLR; Runtime=$Runtime}
$script:Options = New-PSOptions @OptionsArguments $script:Options = New-PSOptions @OptionsArguments
# setup arguments # setup arguments
@ -115,6 +116,9 @@ function Start-PSBuild {
} else { } else {
$Arguments += "build" $Arguments += "build"
} }
if ($Output) {
$Arguments += "--output", (Join-Path $PSScriptRoot $Output)
}
$Arguments += "--configuration", $Options.Configuration $Arguments += "--configuration", $Options.Configuration
$Arguments += "--framework", $Options.Framework $Arguments += "--framework", $Options.Framework
$Arguments += "--runtime", $Options.Runtime $Arguments += "--runtime", $Options.Runtime
@ -212,6 +216,7 @@ function New-PSOptions {
[string]$Runtime, [string]$Runtime,
[switch]$Publish, [switch]$Publish,
[string]$Output,
[switch]$FullCLR [switch]$FullCLR
) )
@ -261,7 +266,10 @@ function New-PSOptions {
"powershell.exe" "powershell.exe"
} }
# Build the Output path in script scope # Build the Output path
if ($Output) {
$Output = Join-Path $PSScriptRoot $Output
} else {
$Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework) $Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework)
# FullCLR only builds a library, so there is no runtime component # FullCLR only builds a library, so there is no runtime component
@ -275,6 +283,7 @@ function New-PSOptions {
} }
$Output = [IO.Path]::Combine($Output, $Executable) $Output = [IO.Path]::Combine($Output, $Executable)
}
return @{ Top = $Top; return @{ Top = $Top;
Configuration = $Configuration; Configuration = $Configuration;

View file

@ -2,7 +2,7 @@ Debugging
========= =========
VS Code VS Code
------- =======
[Experimental .NET Core Debugging in VS Code][core-debug] enables [Experimental .NET Core Debugging in VS Code][core-debug] enables
cross-platform debugging with the [Visual Studio Code][vscode] editor. cross-platform debugging with the [Visual Studio Code][vscode] editor.
@ -38,19 +38,32 @@ process named `powershell`, and will attach to it. If you need more
fine grained control, replace `processName` with `processId` and fine grained control, replace `processName` with `processId` and
provide a PID. (Please be careful not to commit such a change). provide a PID. (Please be careful not to commit such a change).
Important Note
--------------
Debugging is very sensitive to the versions of our .NET Core packages, VS Code,
and the C# extension.
- Use the VS Code [Insiders][] build
- Use the latest pre-release of the [C# extension][]
- Refer to the pre-release [documentation][]
[core-debug]: https://blogs.msdn.microsoft.com/visualstudioalm/2016/03/10/experimental-net-core-debugging-in-vs-code/ [core-debug]: https://blogs.msdn.microsoft.com/visualstudioalm/2016/03/10/experimental-net-core-debugging-in-vs-code/
[vscode]: https://code.visualstudio.com/ [vscode]: https://code.visualstudio.com/
[OmniSharp]: https://github.com/OmniSharp/omnisharp-vscode [OmniSharp]: https://github.com/OmniSharp/omnisharp-vscode
[vscclrdebugger]: http://aka.ms/vscclrdebugger [vscclrdebugger]: http://aka.ms/vscclrdebugger
[insiders]: https://code.visualstudio.com/insiders
[C# extension]: https://github.com/OmniSharp/omnisharp-vscode/releases
[documentation]: https://github.com/OmniSharp/omnisharp-vscode/pull/157
corehost corehost
-------- ========
The native executable prouduced by .NET CLI will produce trace output The native executable prouduced by .NET CLI will produce trace output
if launched with `COREHOST_TRACE=1 ./powershell`. if launched with `COREHOST_TRACE=1 ./powershell`.
CoreCLR PAL CoreCLR PAL
----------- ===========
The native code in the CLR has debug channels to selectively output The native code in the CLR has debug channels to selectively output
information to the console. These are controlled by the information to the console. These are controlled by the

View file

@ -8,7 +8,7 @@
}, },
"dependencies": { "dependencies": {
"Microsoft.Management.Infrastructure.Native": "1.0.0-rc3" "Microsoft.Management.Infrastructure.Native": "1.0.0-rc4"
}, },
"frameworks": { "frameworks": {

@ -1 +1 @@
Subproject commit 674541f7444de5be5f8c63e3a2ef2d98739c1943 Subproject commit 7144b55bdafb71dc91af4f5fb13b6e14904b789f