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.
This commit is contained in:
Aditya Patwardhan 2017-08-28 16:10:03 -07:00 committed by Dongbo Wang
parent deb8c4485d
commit fd047a8250
2 changed files with 19 additions and 26 deletions

View File

@ -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

View File

@ -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) {