Merge pull request #788 from PowerShell/andschwa/publish

Add Publish support to Start-PSbuild
This commit is contained in:
Andy Schwartzmeyer 2016-04-08 16:38:45 -07:00
commit a69ed31baf
2 changed files with 22 additions and 9 deletions

View file

@ -24,7 +24,9 @@ function Start-PSBuild {
[CmdletBinding(DefaultParameterSetName='CoreCLR')]
param(
[switch]$Restore,
[switch]$Clean,
[Parameter(ParameterSetName='CoreCLR')]
[switch]$Publish,
# These runtimes must match those in project.json
# We do not use ValidateScript since we want tab completion
@ -118,16 +120,27 @@ function Start-PSBuild {
}
$Arguments = @()
if ($Publish) {
$Arguments += "publish"
} else {
$Arguments += "build"
}
$Arguments += "--framework", $Framework
$Arguments += "--configuration", $Configuration
$Arguments += "--runtime", $Runtime
# Build the Output path in script scope
$script:Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework)
# FullCLR only builds a library, so there is no runtime component
if ($FullCLR) {
$script:Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework, $Executable)
} else {
$script:Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework, $Runtime, $Executable)
if (-Not $FullCLR) {
$script:Output = [IO.Path]::Combine($script:Output, $Runtime)
}
# Publish injects the publish directory
if ($Publish) {
$script:Output = [IO.Path]::Combine($script:Output, "publish")
}
$script:Output = [IO.Path]::Combine($script:Output, $Executable)
Write-Verbose "script:Output is $script:Output"
# handle Restore
@ -193,7 +206,7 @@ function Start-PSBuild {
# Relative paths do not work well if cwd is not changed to project
log "Run `dotnet build $Arguments` from $pwd"
Push-Location $Top
dotnet build $Arguments
dotnet $Arguments
log "PowerShell output: $script:Output"
} finally {
Pop-Location

View file

@ -26,7 +26,7 @@ build_script:
$env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli"
dotnet --version
Import-Module .\PowerShellGitHubDev.psm1
Start-PSBuild
Start-PSBuild -Publish
Start-PSBuild -FullCLR
test_script:
@ -35,7 +35,7 @@ test_script:
$ErrorActionPreference = 'Stop'
#
# CoreCLR
$env:CoreOutput = "$pwd\src\Microsoft.PowerShell.CoreConsoleHost\bin\Debug\netstandardapp1.5\win81-x64"
$env:CoreOutput = "$pwd\src\Microsoft.PowerShell.CoreConsoleHost\bin\Debug\netstandardapp1.5\win81-x64\publish"
Write-Host -Foreground Green 'Run CoreCLR tests'
$testResultsFile = "$pwd\TestsResults.xml"
& ("$env:CoreOutput\powershell.exe") -c "Invoke-Pester test/powershell -OutputFormat NUnitXml -OutputFile $testResultsFile"
@ -45,7 +45,7 @@ test_script:
$env:FullOutput = "$pwd\src\Microsoft.PowerShell.ConsoleHost\bin\Debug\net451"
Write-Host -Foreground Green 'Run FullCLR tests'
$testResultsFileFullCLR = "$pwd\TestsResults.FullCLR.xml"
Start-DevPSGitHub -binDir $env:FullOutput -NoNewWindow -ArgumentList '-command', "Import-Module .\src\Modules\Pester; Import-Module .\bin\Modules\Microsoft.PowerShell.Platform; Invoke-Pester test/fullCLR -OutputFormat NUnitXml -OutputFile $testResultsFileFullCLR"
Start-DevPSGitHub -binDir $env:FullOutput -NoNewWindow -ArgumentList '-command', "Import-Module .\src\Modules\Pester; Invoke-Pester test/fullCLR -OutputFormat NUnitXml -OutputFile $testResultsFileFullCLR"
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFileFullCLR))
#
# Fail the build, if tests failed