From fd047a82506ac6a38c20052f45683cf5407c9c3a Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 28 Aug 2017 16:10:03 -0700 Subject: [PATCH] Creates a single package for Windows (#4540) The updates to build.psm1 and packaging.psm1 create a single package (per bitness), which works on all the Windows OS versions, namely Windows 7 / Windows Server 2008 R2, Windows 8.1 / Windows Server 2012 R2, Windows 10 / Windows Server 2016. --- docs/maintainers/releasing.md | 17 ++++++----------- tools/packaging/packaging.psm1 | 28 +++++++++++++--------------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/docs/maintainers/releasing.md b/docs/maintainers/releasing.md index 280e8d7b37..5502d3dcb6 100644 --- a/docs/maintainers/releasing.md +++ b/docs/maintainers/releasing.md @@ -160,20 +160,15 @@ On Windows, the `-Runtime` parameter should be specified for `Start-PSBuild` to # Install dependencies Start-PSBootstrap -Package -# Build for v6.0.0-beta.1 release targeting Windows 10 and Server 2016 -Start-PSBuild -Clean -CrossGen -PSModuleRestore -Runtime win10-x64 -Configuration Release -ReleaseTag v6.0.0-beta.1 +# Build for v6.0.0-beta.1 release targeting Windows universal package, set -Runtime to win7-x64 +Start-PSBuild -Clean -CrossGen -PSModuleRestore -Runtime win7-x64 -Configuration Release -ReleaseTag v6.0.0-beta.1 ``` -If the package is targeting a downlevel Windows (not Windows 10 or Server 2016), -the `-WindowsDownLevel` parameter should be specified for `Start-PSPackage`. -Otherwise, the `-WindowsDownLevel` parameter should be left out. - ```powershell -# Create packages for v6.0.0-beta.1 release targeting Windows 10 and Server 2016. -# When creating packages for downlevel Windows, such as Windows 8.1 or Server 2012R2, -# the parameter '-WindowsDownLevel' must be specified. -Start-PSPackage -Type msi -ReleaseTag v6.0.0-beta.1 <# -WindowsDownLevel win81-x64 #> -Start-PSPackage -Type zip -ReleaseTag v6.0.0-beta.1 <# -WindowsDownLevel win81-x64 #> +# Create packages for v6.0.0-beta.1 release targeting Windows universal package. +# 'win7-x64' / 'win7-x86' should be used for -WindowsRuntime. +Start-PSPackage -Type msi -ReleaseTag v6.0.0-beta.1 -WindowsRuntime 'win7-x64' +Start-PSPackage -Type zip -ReleaseTag v6.0.0-beta.1 -WindowsRuntime 'win7-x64' ``` ## NuGet Packages diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 7a7e193bca..01942008d6 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -23,9 +23,9 @@ function Start-PSPackage { [string[]]$Type, # Generate windows downlevel package - [ValidateSet("win81-x64", "win7-x86", "win7-x64")] + [ValidateSet("win7-x86", "win7-x64")] [ValidateScript({$Environment.IsWindows})] - [string]$WindowsDownLevel, + [string]$WindowsRuntime, [Switch] $Force, @@ -35,11 +35,20 @@ function Start-PSPackage { ) # Runtime and Configuration settings required by the package - ($Runtime, $Configuration) = if ($WindowsDownLevel) { - $WindowsDownLevel, "Release" + ($Runtime, $Configuration) = if ($WindowsRuntime) { + $WindowsRuntime, "Release" } else { New-PSOptions -Configuration "Release" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration } } + + # We convert the runtime to win7-x64 or win7-x86 to build the universal windows package. + if($Environment.IsWindows) { + $Runtime = $Runtime -replace "win\d+", "win7" + + # Build the name suffix for win-plat packages + $NameSuffix = $Runtime -replace 'win\d+', 'win' + } + log "Packaging RID: '$Runtime'; Packaging Configuration: '$Configuration'" $Script:Options = Get-PSOptions @@ -119,17 +128,6 @@ function Start-PSPackage { } log "Packaging Type: $Type" - # Build the name suffix for win-plat packages - if ($Environment.IsWindows) { - # Add the server name to the $RunTime. $runtime produced by dotnet is same for client or server - switch ($Runtime) { - 'win81-x64' {$NameSuffix = 'win81-win2012r2-x64'} - 'win10-x64' {$NameSuffix = 'win10-win2016-x64'} - 'win7-x64' {$NameSuffix = 'win7-win2008r2-x64'} - Default {$NameSuffix = $Runtime} - } - } - # Add the symbols to the suffix # if symbols are specified to be included if($IncludeSymbols.IsPresent -and $NameSuffix) {