Add Start-PSBuild -Output switch

When specified, it will join the given path relative to the PowerShell
repository. This is useful to choose where the built artifacts will
end-up, which is necessary to fix VS Code tasks.
This commit is contained in:
Andrew Schwartzmeyer 2016-05-06 10:28:45 -07:00
parent ce7e96d7fa
commit eb92b28965

View file

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