From 0459d0b036a4ccad49f1b4a84393101d58826360 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Sat, 5 Aug 2017 11:32:54 -0700 Subject: [PATCH 1/9] Add RootInfo to PSOptions --- build.psm1 | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/build.psm1 b/build.psm1 index be3c257e8bf..c625e7a1e1d 100644 --- a/build.psm1 +++ b/build.psm1 @@ -723,7 +723,24 @@ function New-PSOptions { $Top = [IO.Path]::Combine($PSScriptRoot, "src", "System.Management.Automation") } - return @{ Top = $Top; + $RootInfo = @{RepoPath = $PSScriptRoot} + + # the valid root is the root of the filesystem and the folder PowerShell + $RootInfo += @{ValidPath = Join-Path -Path ([system.io.path]::GetPathRoot($RootInfo.RepoPath)) -ChildPath 'PowerShell' } + + if($RepoInfo.RepoPath -ne $RootInfo.ValidPath) + { + $RootInfo += @{Warning = "Please ensure you repo is at the root of the file system and named 'PowerShell' (example: '$($RootInfo.ValidPath)'), when building and packaging for release!" } + $RootInfo += @{IsValid = $false} + Write-Warning -Message $RootInfo.Warning + } + else + { + $RootInfo += @{IsValid = $true} + } + + return @{ RootInfo = [PSCustomObject]$RootInfo + Top = $Top; Configuration = $Configuration; Framework = $Framework; Runtime = $Runtime; From abbc96925cbb33fdc2137fcbd4a5f9e6b2560da1 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Mon, 14 Aug 2017 08:26:55 -0700 Subject: [PATCH 2/9] stop packaging release if RootInfo is not valid --- tools/packaging/packaging.psm1 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 88f83ed2218..96dc141e789 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -81,6 +81,14 @@ function Start-PSPackage { throw "Please ensure you have run 'Start-PSBuild $params'!" } + if($ConfigurationOption -iin 'Release','Linux') + { + if(!$Script:Options.RootInfo.IsValid) + { + throw $Script:Options.RootInfo.Warning + } + } + # If ReleaseTag is specified, use the given tag to calculate Vesrion if ($PSCmdlet.ParameterSetName -eq "ReleaseTag") { $Version = $ReleaseTag -Replace '^v' From ad3192a8e65e1ae365e4d089798c6c42b49f32ad Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Mon, 7 Aug 2017 10:19:32 -0700 Subject: [PATCH 3/9] add ability to skip release checks --- tools/packaging/packaging.psm1 | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 96dc141e789..48fe3651716 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -29,7 +29,9 @@ function Start-PSPackage { [Switch] $Force, - [Switch] $IncludeSymbols + [Switch] $IncludeSymbols, + + [Switch] $SkipReleaseChecks ) # Runtime and Configuration settings required by the package @@ -81,12 +83,12 @@ function Start-PSPackage { throw "Please ensure you have run 'Start-PSBuild $params'!" } - if($ConfigurationOption -iin 'Release','Linux') - { - if(!$Script:Options.RootInfo.IsValid) - { - throw $Script:Options.RootInfo.Warning - } + if($SkipReleaseChecks.IsPresent) { + Write-Warning "Skipping release checks." + } + + if(!$Script:Options.RootInfo.IsValid -and -not $SkipReleaseChecks.IsPresent){ + throw $Script:Options.RootInfo.Warning } # If ReleaseTag is specified, use the given tag to calculate Vesrion From 54c56d9e66d31a5db39744455627a258c078c6b1 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Mon, 7 Aug 2017 10:21:19 -0700 Subject: [PATCH 4/9] skip release checking when packaging in CI --- tools/appveyor.psm1 | 2 +- tools/travis.ps1 | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index a278922aeb2..068577c0856 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -448,7 +448,7 @@ function Invoke-AppveyorFinish } # Build packages - $packages = Start-PSPackage @packageParams + $packages = Start-PSPackage @packageParams -SkipReleaseChecks $name = Get-PackageName diff --git a/tools/travis.ps1 b/tools/travis.ps1 index 58a8aad1ef3..d49e102cb2a 100644 --- a/tools/travis.ps1 +++ b/tools/travis.ps1 @@ -179,8 +179,9 @@ else $packageParams += @{Version=$version} } # Only build packages for branches, not pull requests - $packages = @(Start-PSPackage @packageParams) - $packages += Start-PSPackage @packageParams -Type AppImage + $packages = @(Start-PSPackage @packageParams -SkipReleaseChecks) + # Packaging AppImage depends on the deb package + $packages += Start-PSPackage @packageParams -Type AppImage -SkipReleaseChecks foreach($package in $packages) { # Publish the packages to the nuget feed if: From 2783c817bcd7bd00df1a015ef3d8b9fc413cbe6f Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Mon, 14 Aug 2017 15:50:29 -0700 Subject: [PATCH 5/9] remove warning for invalid root --- build.psm1 | 1 - 1 file changed, 1 deletion(-) diff --git a/build.psm1 b/build.psm1 index c625e7a1e1d..015f547810e 100644 --- a/build.psm1 +++ b/build.psm1 @@ -732,7 +732,6 @@ function New-PSOptions { { $RootInfo += @{Warning = "Please ensure you repo is at the root of the file system and named 'PowerShell' (example: '$($RootInfo.ValidPath)'), when building and packaging for release!" } $RootInfo += @{IsValid = $false} - Write-Warning -Message $RootInfo.Warning } else { From 842899e50c1a7edd3f43854291265a674a5ac496 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Mon, 14 Aug 2017 15:50:40 -0700 Subject: [PATCH 6/9] remove extra space --- tools/travis.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/travis.ps1 b/tools/travis.ps1 index d49e102cb2a..8d5dadbb0d9 100644 --- a/tools/travis.ps1 +++ b/tools/travis.ps1 @@ -179,7 +179,7 @@ else $packageParams += @{Version=$version} } # Only build packages for branches, not pull requests - $packages = @(Start-PSPackage @packageParams -SkipReleaseChecks) + $packages = @(Start-PSPackage @packageParams -SkipReleaseChecks) # Packaging AppImage depends on the deb package $packages += Start-PSPackage @packageParams -Type AppImage -SkipReleaseChecks foreach($package in $packages) From faf529d4b4f88415d5b77c2d2a5cd3c23cfbe1da Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Mon, 14 Aug 2017 15:51:14 -0700 Subject: [PATCH 7/9] simply conditional using elseif --- tools/packaging/packaging.psm1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 48fe3651716..026a3535237 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -86,8 +86,7 @@ function Start-PSPackage { if($SkipReleaseChecks.IsPresent) { Write-Warning "Skipping release checks." } - - if(!$Script:Options.RootInfo.IsValid -and -not $SkipReleaseChecks.IsPresent){ + elseif(!$Script:Options.RootInfo.IsValid){ throw $Script:Options.RootInfo.Warning } From 3d2ba14928b2f71427714f3b8f5cdad304a44978 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 14 Aug 2017 16:04:40 -0700 Subject: [PATCH 8/9] Remove extra space --- tools/travis.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/travis.ps1 b/tools/travis.ps1 index 8d5dadbb0d9..4b681dc69ed 100644 --- a/tools/travis.ps1 +++ b/tools/travis.ps1 @@ -181,7 +181,7 @@ else # Only build packages for branches, not pull requests $packages = @(Start-PSPackage @packageParams -SkipReleaseChecks) # Packaging AppImage depends on the deb package - $packages += Start-PSPackage @packageParams -Type AppImage -SkipReleaseChecks + $packages += Start-PSPackage @packageParams -Type AppImage -SkipReleaseChecks foreach($package in $packages) { # Publish the packages to the nuget feed if: From d6c0ce7fc10a3fec9c720ffbb1ebe87073c51dbf Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Tue, 15 Aug 2017 11:18:40 -0700 Subject: [PATCH 9/9] Address PR feedback regarding adding hashtables --- build.psm1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.psm1 b/build.psm1 index 015f547810e..240ddf75a48 100644 --- a/build.psm1 +++ b/build.psm1 @@ -726,16 +726,16 @@ function New-PSOptions { $RootInfo = @{RepoPath = $PSScriptRoot} # the valid root is the root of the filesystem and the folder PowerShell - $RootInfo += @{ValidPath = Join-Path -Path ([system.io.path]::GetPathRoot($RootInfo.RepoPath)) -ChildPath 'PowerShell' } + $RootInfo['ValidPath'] = Join-Path -Path ([system.io.path]::GetPathRoot($RootInfo.RepoPath)) -ChildPath 'PowerShell' if($RepoInfo.RepoPath -ne $RootInfo.ValidPath) { - $RootInfo += @{Warning = "Please ensure you repo is at the root of the file system and named 'PowerShell' (example: '$($RootInfo.ValidPath)'), when building and packaging for release!" } - $RootInfo += @{IsValid = $false} + $RootInfo['Warning'] = "Please ensure you repo is at the root of the file system and named 'PowerShell' (example: '$($RootInfo.ValidPath)'), when building and packaging for release!" + $RootInfo['IsValid'] = $false } else { - $RootInfo += @{IsValid = $true} + $RootInfo['IsValid'] = $true } return @{ RootInfo = [PSCustomObject]$RootInfo