From b5ab2aeb7154454f193b072ec209d976e2d810fa Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Fri, 29 Jan 2021 21:51:09 -0800 Subject: [PATCH 01/22] Avoid CrossGen and exclude GraphicHost from the build --- build.psm1 | 53 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/build.psm1 b/build.psm1 index 9d8d267969b..00329ec0f31 100644 --- a/build.psm1 +++ b/build.psm1 @@ -271,6 +271,7 @@ function Start-PSBuild { [Parameter(ParameterSetName="Default")] [switch]$NoPSModuleRestore, [switch]$CI, + [switch]$ForGuestConfigService, # Skips the step where the pwsh that's been built is used to create a configuration # Useful when changing parsing/compilation, since bugs there can mean we can't get past this step @@ -320,6 +321,15 @@ function Start-PSBuild { if ("win-arm","win-arm64" -contains $Runtime -and -not $environment.IsWindows) { throw "Cross compiling for win-arm or win-arm64 is only supported on Windows environment" } + + if ($ForGuestConfigService -and $Runtime -and "linux-x64", "win7-x64", "osx-x64" -notcontains $Runtime) { + throw "Special build for the Guest Config service is done only for following runtimes: 'linux-x64', 'win7-x64', 'osx-x64'" + } + + if ($ForGuestConfigService -and $CrossGen) { + throw "Special build for the Guest Config service requires the minimal disk footprint, so `CrossGen` is not allowed" + } + function Stop-DevPowerShell { Get-Process pwsh* | Where-Object { @@ -389,6 +399,7 @@ Fix steps: Verbose=$true SMAOnly=[bool]$SMAOnly PSModuleRestore=$PSModuleRestore + ForGuestConfigService=$ForGuestConfigService } $script:Options = New-PSOptions @OptionsArguments @@ -413,7 +424,7 @@ Fix steps: # Framework Dependent builds do not support ReadyToRun as it needs a specific runtime to optimize for. # The property is set in Powershell.Common.props file. # We override the property through the build command line. - if($Options.Runtime -like 'fxdependent*') { + if($Options.Runtime -like 'fxdependent*' -or $ForGuestConfigService) { $Arguments += "/property:PublishReadyToRun=false" } @@ -466,12 +477,13 @@ Fix steps: Push-Location $Options.Top if ($Options.Runtime -notlike 'fxdependent*') { - if ($Options.Runtime -like 'win-arm*') { - $Arguments += "/property:SDKToUse=Microsoft.NET.Sdk" - } else { - $Arguments += "/property:SDKToUse=Microsoft.NET.Sdk.WindowsDesktop" + $sdkToUse = 'Microsoft.NET.Sdk' + if ($Options.Runtime -like 'win7-*' -and !$ForGuestConfigService) { + $sdkToUse = 'Microsoft.NET.Sdk.WindowsDesktop' } + $Arguments += "/property:SDKToUse=$sdkToUse" + Write-Log -message "Run dotnet $Arguments from $PWD" Start-NativeExecution { dotnet $Arguments } Write-Log -message "PowerShell output: $($Options.Output)" @@ -650,14 +662,14 @@ function Restore-PSPackage if ($Force -or (-not (Test-Path "$($Options.Top)/obj/project.assets.json"))) { - $sdkToUse = if (($Options.Runtime -eq 'fxdependent-win-desktop' -or $Options.Runtime -like 'win*')) { # this is fxd or some windows runtime - if ($Options.Runtime -like 'win-arm*') { - 'Microsoft.NET.Sdk' - } else { - 'Microsoft.NET.Sdk.WindowsDesktop' + if ($Options.Runtime -eq 'fxdependent-win-desktop') { + $sdkToUse = 'Microsoft.NET.Sdk.WindowsDesktop' + } + else { + $sdkToUse = 'Microsoft.NET.Sdk' + if ($Options.Runtime -like 'win7-*' -and !$ForGuestConfigService) { + $sdkToUse = 'Microsoft.NET.Sdk.WindowsDesktop' } - } else { - 'Microsoft.NET.Sdk' } if ($PSModule.IsPresent) { @@ -782,7 +794,9 @@ function New-PSOptions { [switch]$SMAOnly, - [switch]$PSModuleRestore + [switch]$PSModuleRestore, + + [switch]$ForGuestConfigService ) # Add .NET CLI tools to PATH @@ -876,7 +890,8 @@ function New-PSOptions { -Configuration $Configuration ` -PSModuleRestore $PSModuleRestore.IsPresent ` -Framework $Framework ` - -Output $Output + -Output $Output ` + -ForGuestConfigService $ForGuestConfigService } # Get the Options of the last build @@ -3009,7 +3024,8 @@ function Restore-PSOptions { -Configuration $options.Configuration ` -PSModuleRestore $options.PSModuleRestore ` -Framework $options.Framework ` - -Output $options.Output + -Output $options.Output ` + -ForGuestConfigService $options.ForGuestConfigService Set-PSOptions -Options $newOptions } @@ -3046,7 +3062,11 @@ function New-PSOptionsObject [Parameter(Mandatory)] [String] - $Output + $Output, + + [Parameter(Mandatory)] + [Bool] + $ForGuestConfigService ) return @{ @@ -3058,6 +3078,7 @@ function New-PSOptionsObject Output = $Output CrossGen = $CrossGen PSModuleRestore = $PSModuleRestore + ForGuestConfigService = $ForGuestConfigService } } From 204bb25fec25bc072a86d3b95504f14b6793410b Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Sun, 31 Jan 2021 10:46:15 -0800 Subject: [PATCH 02/22] Remove .pdb, .xml files; also remove the PSMaml schemas --- build.psm1 | 8 ++++++-- src/powershell-unix/powershell-unix.csproj | 5 ----- src/powershell-win-core/powershell-win-core.csproj | 5 ----- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/build.psm1 b/build.psm1 index 00329ec0f31..b03f8f56900 100644 --- a/build.psm1 +++ b/build.psm1 @@ -488,8 +488,12 @@ Fix steps: Start-NativeExecution { dotnet $Arguments } Write-Log -message "PowerShell output: $($Options.Output)" - if ($CrossGen) { - ## fxdependent package cannot be CrossGen'ed + if ($ForGuestConfigService) { + # Remove symbol files, xml document files. + Remove-Item "$publishPath\*.pdb", "$publishPath\*.xml" -Force + } + elseif ($CrossGen) { + # fxdependent package cannot be CrossGen'ed Start-CrossGen -PublishPath $publishPath -Runtime $script:Options.Runtime Write-Log -message "pwsh.exe with ngen binaries is available at: $($Options.Output)" } diff --git a/src/powershell-unix/powershell-unix.csproj b/src/powershell-unix/powershell-unix.csproj index 802acf05e3a..91edefea62b 100644 --- a/src/powershell-unix/powershell-unix.csproj +++ b/src/powershell-unix/powershell-unix.csproj @@ -19,11 +19,6 @@ PreserveNewest PreserveNewest - - Schemas\PSMaml\%(FileName)%(Extension) - PreserveNewest - PreserveNewest - PreserveNewest PreserveNewest diff --git a/src/powershell-win-core/powershell-win-core.csproj b/src/powershell-win-core/powershell-win-core.csproj index 16f625827d4..939386cc909 100644 --- a/src/powershell-win-core/powershell-win-core.csproj +++ b/src/powershell-win-core/powershell-win-core.csproj @@ -24,11 +24,6 @@ PreserveNewest PreserveNewest - - Schemas\PSMaml\%(FileName)%(Extension) - PreserveNewest - PreserveNewest - PreserveNewest PreserveNewest From c5751fc543ca2c00d51d7cd67a959f6930845073 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Thu, 25 Feb 2021 17:10:12 -0800 Subject: [PATCH 03/22] Integrate the min-size package to release build --- build.psm1 | 34 +++--- tools/packaging/packaging.psm1 | 36 +++++- .../PowerShellPackage.ps1 | 115 ++++++++++-------- .../releaseBuild/azureDevOps/releaseBuild.yml | 36 ++++-- .../azureDevOps/templates/upload.yml | 4 +- .../templates/windows-hosted-build.yml | 8 +- .../templates/windows-packaging.yml | 6 +- 7 files changed, 146 insertions(+), 93 deletions(-) diff --git a/build.psm1 b/build.psm1 index b03f8f56900..d8b56031bd2 100644 --- a/build.psm1 +++ b/build.psm1 @@ -271,7 +271,7 @@ function Start-PSBuild { [Parameter(ParameterSetName="Default")] [switch]$NoPSModuleRestore, [switch]$CI, - [switch]$ForGuestConfigService, + [switch]$ForMinimalSize, # Skips the step where the pwsh that's been built is used to create a configuration # Useful when changing parsing/compilation, since bugs there can mean we can't get past this step @@ -322,12 +322,12 @@ function Start-PSBuild { throw "Cross compiling for win-arm or win-arm64 is only supported on Windows environment" } - if ($ForGuestConfigService -and $Runtime -and "linux-x64", "win7-x64", "osx-x64" -notcontains $Runtime) { - throw "Special build for the Guest Config service is done only for following runtimes: 'linux-x64', 'win7-x64', 'osx-x64'" + if ($ForMinimalSize -and $Runtime -and "linux-x64", "win7-x64", "osx-x64" -notcontains $Runtime) { + throw "Build for the minimal size is enabled only for following runtimes: 'linux-x64', 'win7-x64', 'osx-x64'" } - if ($ForGuestConfigService -and $CrossGen) { - throw "Special build for the Guest Config service requires the minimal disk footprint, so `CrossGen` is not allowed" + if ($ForMinimalSize -and $CrossGen) { + throw "Build for the minimal size requires the minimal disk footprint, so `CrossGen` is not allowed" } function Stop-DevPowerShell { @@ -399,7 +399,7 @@ Fix steps: Verbose=$true SMAOnly=[bool]$SMAOnly PSModuleRestore=$PSModuleRestore - ForGuestConfigService=$ForGuestConfigService + ForMinimalSize=$ForMinimalSize } $script:Options = New-PSOptions @OptionsArguments @@ -424,7 +424,7 @@ Fix steps: # Framework Dependent builds do not support ReadyToRun as it needs a specific runtime to optimize for. # The property is set in Powershell.Common.props file. # We override the property through the build command line. - if($Options.Runtime -like 'fxdependent*' -or $ForGuestConfigService) { + if($Options.Runtime -like 'fxdependent*' -or $ForMinimalSize) { $Arguments += "/property:PublishReadyToRun=false" } @@ -478,7 +478,7 @@ Fix steps: if ($Options.Runtime -notlike 'fxdependent*') { $sdkToUse = 'Microsoft.NET.Sdk' - if ($Options.Runtime -like 'win7-*' -and !$ForGuestConfigService) { + if ($Options.Runtime -like 'win7-*' -and !$ForMinimalSize) { $sdkToUse = 'Microsoft.NET.Sdk.WindowsDesktop' } @@ -488,11 +488,7 @@ Fix steps: Start-NativeExecution { dotnet $Arguments } Write-Log -message "PowerShell output: $($Options.Output)" - if ($ForGuestConfigService) { - # Remove symbol files, xml document files. - Remove-Item "$publishPath\*.pdb", "$publishPath\*.xml" -Force - } - elseif ($CrossGen) { + if ($CrossGen) { # fxdependent package cannot be CrossGen'ed Start-CrossGen -PublishPath $publishPath -Runtime $script:Options.Runtime Write-Log -message "pwsh.exe with ngen binaries is available at: $($Options.Output)" @@ -671,7 +667,7 @@ function Restore-PSPackage } else { $sdkToUse = 'Microsoft.NET.Sdk' - if ($Options.Runtime -like 'win7-*' -and !$ForGuestConfigService) { + if ($Options.Runtime -like 'win7-*' -and !$ForMinimalSize) { $sdkToUse = 'Microsoft.NET.Sdk.WindowsDesktop' } } @@ -800,7 +796,7 @@ function New-PSOptions { [switch]$PSModuleRestore, - [switch]$ForGuestConfigService + [switch]$ForMinimalSize ) # Add .NET CLI tools to PATH @@ -895,7 +891,7 @@ function New-PSOptions { -PSModuleRestore $PSModuleRestore.IsPresent ` -Framework $Framework ` -Output $Output ` - -ForGuestConfigService $ForGuestConfigService + -ForMinimalSize $ForMinimalSize } # Get the Options of the last build @@ -3029,7 +3025,7 @@ function Restore-PSOptions { -PSModuleRestore $options.PSModuleRestore ` -Framework $options.Framework ` -Output $options.Output ` - -ForGuestConfigService $options.ForGuestConfigService + -ForMinimalSize $options.ForMinimalSize Set-PSOptions -Options $newOptions } @@ -3070,7 +3066,7 @@ function New-PSOptionsObject [Parameter(Mandatory)] [Bool] - $ForGuestConfigService + $ForMinimalSize ) return @{ @@ -3082,7 +3078,7 @@ function New-PSOptionsObject Output = $Output CrossGen = $CrossGen PSModuleRestore = $PSModuleRestore - ForGuestConfigService = $ForGuestConfigService + ForMinimalSize = $ForMinimalSize } } diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index e42b604d48b..222d79bb5dc 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -29,7 +29,7 @@ function Start-PSPackage { [string]$Name = "powershell", # Ubuntu, CentOS, Fedora, macOS, and Windows packages are supported - [ValidateSet("msix", "deb", "osxpkg", "rpm", "msi", "zip", "zip-pdb", "nupkg", "tar", "tar-arm", "tar-arm64", "tar-alpine", "fxdependent", "fxdependent-win-desktop")] + [ValidateSet("msix", "deb", "osxpkg", "rpm", "msi", "zip", "zip-pdb", "nupkg", "tar", "tar-arm", "tar-arm64", "tar-alpine", "fxdependent", "fxdependent-win-desktop", "min-size")] [string[]]$Type, # Generate windows downlevel package @@ -105,8 +105,9 @@ function Start-PSPackage { $actualParams = @() $crossGenCorrect = $false - if ($Runtime -match "arm") { - # crossgen doesn't support arm32/64 + if ($Runtime -match "arm" -or $Type -eq 'min-size') { + ## crossgen doesn't support arm32/64; + ## For the min-size package, we intentionally avoid crossgen. $crossGenCorrect = $true } elseif ($Script:Options.CrossGen) { @@ -299,7 +300,36 @@ function Start-PSPackage { New-PdbZipPackage @Arguments } } + "min-size" { + # Remove symbol files, xml document files. + Remove-Item "$Source\*.pdb", "$Source\*.xml" -Force + if ($IsWindows) { + $Arguments = @{ + PackageNameSuffix = "$NameSuffix-gc" + PackageSourcePath = $Source + PackageVersion = $Version + Force = $Force + } + + if ($PSCmdlet.ShouldProcess("Create Zip Package")) { + New-ZipPackage @Arguments + } + } + elseif ($IsLinux) { + $Arguments = @{ + PackageSourcePath = $Source + Name = $Name + PackageNameSuffix = 'gc' + Version = $Version + Force = $Force + } + + if ($PSCmdlet.ShouldProcess("Create tar.gz Package")) { + New-TarballPackage @Arguments + } + } + } { $_ -like "fxdependent*" } { ## Remove PDBs from package to reduce size. if(-not $IncludeSymbols.IsPresent) { diff --git a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 index f9d84dfeaf2..709ed26de5d 100644 --- a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 @@ -12,13 +12,16 @@ param ( [string] $destination = "$env:WORKSPACE", [ValidateSet("win7-x64", "win7-x86", "win-arm", "win-arm64", "fxdependent", "fxdependent-win-desktop")] - [string]$Runtime = 'win7-x64', + [string] $Runtime = 'win7-x64', + + [ValidateSet("min-size")] + [string] $Configuration = '', [switch] $Wait, [ValidatePattern("^v\d+\.\d+\.\d+(-\w+(\.\d+)?)?$")] [ValidateNotNullOrEmpty()] - [string]$ReleaseTag, + [string] $ReleaseTag, [Parameter(Mandatory,ParameterSetName='IncludeSymbols')] [switch] $Symbols, @@ -63,7 +66,8 @@ if ($memoryMB -lt $requiredMemoryMB) } Write-Verbose "Running with $memoryMB MB memory." -Verbose -try{ +try +{ Set-Location $location Import-Module "$location\build.psm1" -Force @@ -104,37 +108,83 @@ try{ $buildParams['PSModuleRestore'] = $true } + if ($Configuration -eq 'min-size') + { + $buildParams['ForMinimalSize'] = $true + } + Start-PSBuild -Clean -Runtime $Runtime -Configuration Release @releaseTagParam @buildParams } - if ($Runtime -eq 'fxdependent') + if ($ComponentRegistration.IsPresent) { - $pspackageParams = @{'Type'='fxdependent'} + Write-Verbose "Exporting project.assets files ..." -Verbose + + $projectAssetsCounter = 1 + $projectAssetsFolder = Join-Path -Path $destination -ChildPath 'projectAssets' + $projectAssetsZip = Join-Path -Path $destination -ChildPath 'windowsProjectAssetssymbols.zip' + Get-ChildItem $location\project.assets.json -Recurse | ForEach-Object { + $subfolder = $_.FullName.Replace($location,'') + $subfolder.Replace('project.assets.json','') + $itemDestination = Join-Path -Path $projectAssetsFolder -ChildPath $subfolder + New-Item -Path $itemDestination -ItemType Directory -Force + $file = $_.FullName + Write-Verbose "Copying $file to $itemDestination" -Verbose + Copy-Item -Path $file -Destination "$itemDestination\" -Force + $projectAssetsCounter++ + } + + Compress-Archive -Path $projectAssetsFolder -DestinationPath $projectAssetsZip + Remove-Item -Path $projectAssetsFolder -Recurse -Force -ErrorAction SilentlyContinue + + return } - elseif ($Runtime -eq 'fxdependent-win-desktop') + + if ($Runtime -like 'fxdependent*') { - $pspackageParams = @{'Type'='fxdependent-win-desktop'} + ## Set to the proper package type. + ## No need to specify 'WindowsRuntime' because it's fx-dependent. + $pspackageParams = @{'Type' = $Runtime } } else { - $pspackageParams = @{'Type'='msi'; 'WindowsRuntime'=$Runtime} + ## Set the default package type. + $pspackageParams = @{'Type' = 'msi'; 'WindowsRuntime' = $Runtime} + if ($Configuration -eq 'min-size') + { + ## Special case for the minimal size self-contained package. + $pspackageParams['Type'] = $Configuration + } } - if (!$ComponentRegistration.IsPresent -and !$Symbols.IsPresent -and $Runtime -notmatch 'arm' -and $Runtime -notlike 'fxdependent*') + if (!$Symbols.IsPresent -and $Runtime -notlike 'fxdependent*' -and !$Configuration) { - Write-Verbose "Starting powershell packaging(msi)..." -Verbose - Start-PSPackage @pspackageParams @releaseTagParam - } + if ($Runtime -notmatch 'arm') + { + Write-Verbose "Starting powershell packaging(msi)..." -Verbose + Start-PSPackage @pspackageParams @releaseTagParam + } - if (!$ComponentRegistration.IsPresent -and !$Symbols.IsPresent -and $Runtime -notin 'fxdependent', 'fxdependent-win-desktop') - { $pspackageParams['Type']='msix' $pspackageParams['WindowsRuntime']=$Runtime Write-Verbose "Starting powershell packaging(msix)..." -Verbose Start-PSPackage @pspackageParams @releaseTagParam } - if (!$ComponentRegistration.IsPresent -and $Runtime -notlike 'fxdependent*') + if ($Runtime -like 'fxdependent*' -or $Configuration -eq 'min-size') + { + ## Add symbols for just like zip package. + $pspackageParams['IncludeSymbols']=$Symbols.IsPresent + Start-PSPackage @pspackageParams @releaseTagParam + + ## Copy the fxdependent Zip package to destination. + Get-ChildItem $location\PowerShell-*.zip | ForEach-Object { + $file = $_.FullName + Write-Verbose "Copying $file to $destination" -Verbose + Copy-Item -Path $file -Destination "$destination\" -Force + } + } + else { if (!$Symbols.IsPresent) { $pspackageParams['Type'] = 'zip-pdb' @@ -155,41 +205,6 @@ try{ Copy-Item -Path $file -Destination "$destination\" -Force } } - elseif (!$ComponentRegistration.IsPresent -and $Runtime -like 'fxdependent*') - { - ## Add symbols for just like zip package. - $pspackageParams['IncludeSymbols']=$Symbols.IsPresent - Start-PSPackage @pspackageParams @releaseTagParam - - ## Copy the fxdependent Zip package to destination. - Get-ChildItem $location\PowerShell-*.zip | ForEach-Object { - $file = $_.FullName - Write-Verbose "Copying $file to $destination" -Verbose - Copy-Item -Path $file -Destination "$destination\" -Force - } - } - else - { - Write-Verbose "Exporting project.assets files ..." -Verbose - - $projectAssetsCounter = 1 - $projectAssetsFolder = Join-Path -Path $destination -ChildPath 'projectAssets' - $projectAssetsZip = Join-Path -Path $destination -ChildPath 'windowsProjectAssetssymbols.zip' - Get-ChildItem $location\project.assets.json -Recurse | ForEach-Object { - $subfolder = $_.FullName.Replace($location,'') - $subfolder.Replace('project.assets.json','') - $itemDestination = Join-Path -Path $projectAssetsFolder -ChildPath $subfolder - New-Item -Path $itemDestination -ItemType Directory -Force - $file = $_.FullName - Write-Verbose "Copying $file to $itemDestination" -Verbose - Copy-Item -Path $file -Destination "$itemDestination\" -Force - $projectAssetsCounter++ - } - - Compress-Archive -Path $projectAssetsFolder -DestinationPath $projectAssetsZip - Remove-Item -Path $projectAssetsFolder -Recurse -Force -ErrorAction SilentlyContinue - } - } finally { diff --git a/tools/releaseBuild/azureDevOps/releaseBuild.yml b/tools/releaseBuild/azureDevOps/releaseBuild.yml index 97d86e203ea..41362b73d4c 100644 --- a/tools/releaseBuild/azureDevOps/releaseBuild.yml +++ b/tools/releaseBuild/azureDevOps/releaseBuild.yml @@ -76,6 +76,11 @@ stages: parameters: Architecture: x64 + - template: templates/windows-hosted-build.yml + parameters: + Architecture: x64 + BuildConfiguration: min-size + - template: templates/windows-hosted-build.yml parameters: Architecture: x86 @@ -99,42 +104,49 @@ stages: - template: templates/windows-packaging.yml parameters: Architecture: x64 - parentJob: build_windows_x64 + parentJob: build_windows_x64_release + + - template: templates/windows-packaging.yml + parameters: + Architecture: x64 + BuildConfiguration: min-size + parentJob: build_windows_x64_min-size - template: templates/windows-packaging.yml parameters: Architecture: x86 - parentJob: build_windows_x86 + parentJob: build_windows_x86_release - template: templates/windows-packaging.yml parameters: Architecture: arm - parentJob: build_windows_arm + parentJob: build_windows_arm_release - template: templates/windows-packaging.yml parameters: Architecture: arm64 - parentJob: build_windows_arm64 + parentJob: build_windows_arm64_release - template: templates/windows-packaging.yml parameters: Architecture: fxdependent - parentJob: build_windows_fxdependent + parentJob: build_windows_fxdependent_release - template: templates/windows-packaging.yml parameters: Architecture: fxdependentWinDesktop - parentJob: build_windows_fxdependentWinDesktop + parentJob: build_windows_fxdependentWinDesktop_release - template: templates/windows-package-signing.yml parameters: parentJobs: - - sign_windows_x64 - - sign_windows_x86 - - sign_windows_arm - - sign_windows_arm64 - - sign_windows_fxdependent - - sign_windows_fxdependentWinDesktop + - sign_windows_x64_release + - sign_windows_x64_min-size + - sign_windows_x86_release + - sign_windows_arm_release + - sign_windows_arm64_release + - sign_windows_fxdependent_release + - sign_windows_fxdependentWinDesktop_release - stage: compliance dependsOn: ['windows'] diff --git a/tools/releaseBuild/azureDevOps/templates/upload.yml b/tools/releaseBuild/azureDevOps/templates/upload.yml index 7a617b86422..7f99e3d0c5c 100644 --- a/tools/releaseBuild/azureDevOps/templates/upload.yml +++ b/tools/releaseBuild/azureDevOps/templates/upload.yml @@ -26,12 +26,12 @@ steps: - template: upload-final-results.yml parameters: artifactPath: $(System.ArtifactsDirectory)\signed - artifactFilter: PowerShell-${{ parameters.version }}-win-${{ parameters.architecture }}.zip + artifactFilter: PowerShell-${{ parameters.version }}-win-${{ parameters.architecture }}*.zip - task: AzureFileCopy@4 displayName: 'upload signed zip to Azure - ${{ parameters.architecture }}' inputs: - SourcePath: '$(System.ArtifactsDirectory)\signed\PowerShell-${{ parameters.version }}-win-${{ parameters.architecture }}.zip' + SourcePath: '$(System.ArtifactsDirectory)\signed\PowerShell-${{ parameters.version }}-win-${{ parameters.architecture }}*.zip' azureSubscription: '$(AzureFileCopySubscription)' Destination: AzureBlob storage: '$(StorageAccount)' diff --git a/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml b/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml index 8640858152d..43fd2687c73 100644 --- a/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml +++ b/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml @@ -9,8 +9,8 @@ parameters: default: '' jobs: -- job: build_windows_${{ parameters.Architecture }} - displayName: Build Windows - ${{ parameters.Architecture }} +- job: build_windows_${{ parameters.Architecture }}_${{ parameters.BuildConfiguration }} + displayName: Build Windows - ${{ parameters.Architecture }} ${{ parameters.BuildConfiguration }} condition: succeeded() dependsOn: ${{ parameters.parentJob }} pool: @@ -56,8 +56,8 @@ jobs: "fxdependentWinDesktop" { "fxdependent-win-desktop" } } - tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 -location '$(PowerShellRoot)' -destination '$(Build.ArtifactStagingDirectory)/Symbols_$(Architecture)' -Runtime $runtime -ReleaseTag '$(ReleaseTagVar)' -Symbols - displayName: 'Build Windows Universal - $(Architecture) Symbols zip' + tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 -location '$(PowerShellRoot)' -destination '$(Build.ArtifactStagingDirectory)/Symbols_$(Architecture)' -Runtime $runtime -Configuration '$(BuildConfiguration)' -ReleaseTag '$(ReleaseTagVar)' -Symbols + displayName: 'Build Windows Universal - $(Architecture)-$(BuildConfiguration) Symbols zip' - powershell: | $packageName = (Get-ChildItem '$(Build.ArtifactStagingDirectory)\Symbols_$(Architecture)').FullName diff --git a/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml b/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml index 1554afccaba..702318c8c21 100644 --- a/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml +++ b/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml @@ -9,8 +9,8 @@ parameters: default: '' jobs: -- job: sign_windows_${{ parameters.Architecture }} - displayName: Package Windows - ${{ parameters.Architecture }} +- job: sign_windows_${{ parameters.Architecture }}_${{ parameters.BuildConfiguration }} + displayName: Package Windows - ${{ parameters.Architecture }} ${{ parameters.BuildConfiguration }} condition: succeeded() dependsOn: ${{ parameters.parentJob }} pool: @@ -252,7 +252,7 @@ jobs: Write-Verbose -Verbose -Message "signedPkg = $signedPkg" - $(PowerShellRoot)/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 -BuildZip $signedPkg -location '$(PowerShellRoot)' -destination '$(System.ArtifactsDirectory)\pkgSigned' -Runtime $runtime -ReleaseTag '$(ReleaseTagVar)' + $(PowerShellRoot)/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 -BuildZip $signedPkg -location '$(PowerShellRoot)' -destination '$(System.ArtifactsDirectory)\pkgSigned' -Runtime $runtime -Configuration '$(BuildConfiguration)' -ReleaseTag '$(ReleaseTagVar)' displayName: 'Build Windows Universal - $(Architecture) Package' - powershell: | From 6d7e5d668a5fa6e193ab002713c4dd195c775abf Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Thu, 25 Feb 2021 17:23:47 -0800 Subject: [PATCH 04/22] Fix 'BuildConfiguration' name --- tools/releaseBuild/azureDevOps/releaseBuild.yml | 8 ++++---- .../azureDevOps/templates/windows-hosted-build.yml | 7 ++++++- .../azureDevOps/templates/windows-packaging.yml | 8 ++++++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/tools/releaseBuild/azureDevOps/releaseBuild.yml b/tools/releaseBuild/azureDevOps/releaseBuild.yml index 41362b73d4c..756f2114d5a 100644 --- a/tools/releaseBuild/azureDevOps/releaseBuild.yml +++ b/tools/releaseBuild/azureDevOps/releaseBuild.yml @@ -79,7 +79,7 @@ stages: - template: templates/windows-hosted-build.yml parameters: Architecture: x64 - BuildConfiguration: min-size + BuildConfiguration: minSize - template: templates/windows-hosted-build.yml parameters: @@ -109,8 +109,8 @@ stages: - template: templates/windows-packaging.yml parameters: Architecture: x64 - BuildConfiguration: min-size - parentJob: build_windows_x64_min-size + BuildConfiguration: minSize + parentJob: build_windows_x64_minSize - template: templates/windows-packaging.yml parameters: @@ -141,7 +141,7 @@ stages: parameters: parentJobs: - sign_windows_x64_release - - sign_windows_x64_min-size + - sign_windows_x64_minSize - sign_windows_x86_release - sign_windows_arm_release - sign_windows_arm64_release diff --git a/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml b/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml index 43fd2687c73..37b1953f094 100644 --- a/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml +++ b/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml @@ -56,7 +56,12 @@ jobs: "fxdependentWinDesktop" { "fxdependent-win-desktop" } } - tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 -location '$(PowerShellRoot)' -destination '$(Build.ArtifactStagingDirectory)/Symbols_$(Architecture)' -Runtime $runtime -Configuration '$(BuildConfiguration)' -ReleaseTag '$(ReleaseTagVar)' -Symbols + $configuration = @{} + if ($env:BuildConfiguration -eq 'minSize') { + $configuration['Configuration'] = 'min-size' + } + + tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 -location '$(PowerShellRoot)' -destination '$(Build.ArtifactStagingDirectory)/Symbols_$(Architecture)' -Runtime $runtime -ReleaseTag '$(ReleaseTagVar)' -Symbols @configuration displayName: 'Build Windows Universal - $(Architecture)-$(BuildConfiguration) Symbols zip' - powershell: | diff --git a/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml b/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml index 702318c8c21..5482911bfdd 100644 --- a/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml +++ b/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml @@ -249,10 +249,14 @@ jobs: } $signedPkg = "$(BuildPackagePath)" - Write-Verbose -Verbose -Message "signedPkg = $signedPkg" - $(PowerShellRoot)/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 -BuildZip $signedPkg -location '$(PowerShellRoot)' -destination '$(System.ArtifactsDirectory)\pkgSigned' -Runtime $runtime -Configuration '$(BuildConfiguration)' -ReleaseTag '$(ReleaseTagVar)' + $configuration = @{} + if ($env:BuildConfiguration -eq 'minSize') { + $configuration['Configuration'] = 'min-size' + } + + $(PowerShellRoot)/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 -BuildZip $signedPkg -location '$(PowerShellRoot)' -destination '$(System.ArtifactsDirectory)\pkgSigned' -Runtime $runtime -ReleaseTag '$(ReleaseTagVar)' @configuration displayName: 'Build Windows Universal - $(Architecture) Package' - powershell: | From f0092cb559f607ce68dab50c5da4339f64b6e309 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Thu, 25 Feb 2021 17:58:07 -0800 Subject: [PATCH 05/22] Fix errors --- build.psm1 | 2 +- .../PowerShellPackage.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.psm1 b/build.psm1 index d8b56031bd2..8e1737fbd2c 100644 --- a/build.psm1 +++ b/build.psm1 @@ -667,7 +667,7 @@ function Restore-PSPackage } else { $sdkToUse = 'Microsoft.NET.Sdk' - if ($Options.Runtime -like 'win7-*' -and !$ForMinimalSize) { + if ($Options.Runtime -like 'win7-*' -and !$Options.ForMinimalSize) { $sdkToUse = 'Microsoft.NET.Sdk.WindowsDesktop' } } diff --git a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 index 709ed26de5d..535e23909eb 100644 --- a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 @@ -97,7 +97,7 @@ try else { Write-Verbose "Starting powershell build for RID: $Runtime and ReleaseTag: $ReleaseTag ..." -Verbose - $buildParams = @{'CrossGen'= $Runtime -notmatch "arm" -and $Runtime -notlike "fxdependent*"} + $buildParams = @{'CrossGen'= $Runtime -notmatch "arm" -and $Runtime -notlike "fxdependent*" -and !$Configuration } if($Symbols.IsPresent) { From e2c091239d61c3365a8b213fd9a9a23b7c4885e4 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Thu, 25 Feb 2021 21:33:24 -0800 Subject: [PATCH 06/22] Fix another error --- tools/packaging/packaging.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 222d79bb5dc..e9e95447681 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -47,7 +47,7 @@ function Start-PSPackage { ) DynamicParam { - if ("zip" -eq $Type -or "fxdependent" -eq $Type -or "fxdependent-win-desktop" -eq $Type) { + if ($Type -in ('zip', 'min-size') -or $Type -like 'fxdependent*') { # Add a dynamic parameter '-IncludeSymbols' when the specified package type is 'zip' only. # The '-IncludeSymbols' parameter can be used to indicate that the package should only contain powershell binaries and symbols. $ParameterAttr = New-Object "System.Management.Automation.ParameterAttribute" From 5c73fe3d54bac789e56ac3bd90f4563d03047044 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Fri, 26 Feb 2021 07:50:25 -0800 Subject: [PATCH 07/22] Attempt to fix build --- global.json | 2 +- .../PowerShellPackage.ps1 | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/global.json b/global.json index a6b7a831364..45db27a6952 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "6.0.100-preview.1.21104.4" + "version": "6.0.100-preview.1.21103.13" } } diff --git a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 index 535e23909eb..60842bab979 100644 --- a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 @@ -97,7 +97,7 @@ try else { Write-Verbose "Starting powershell build for RID: $Runtime and ReleaseTag: $ReleaseTag ..." -Verbose - $buildParams = @{'CrossGen'= $Runtime -notmatch "arm" -and $Runtime -notlike "fxdependent*" -and !$Configuration } + $buildParams = @{'CrossGen'= $Runtime -notmatch "arm" -and $Runtime -notlike "fxdependent*" -and !$Configuration} if($Symbols.IsPresent) { @@ -142,9 +142,7 @@ try if ($Runtime -like 'fxdependent*') { - ## Set to the proper package type. - ## No need to specify 'WindowsRuntime' because it's fx-dependent. - $pspackageParams = @{'Type' = $Runtime } + $pspackageParams = @{'Type' = $Runtime} } else { @@ -166,7 +164,6 @@ try } $pspackageParams['Type']='msix' - $pspackageParams['WindowsRuntime']=$Runtime Write-Verbose "Starting powershell packaging(msix)..." -Verbose Start-PSPackage @pspackageParams @releaseTagParam } From 29b36fae1abca1431bcd470d4d6ddcce42ca1a27 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Fri, 26 Feb 2021 08:04:54 -0800 Subject: [PATCH 08/22] Fix build break --- tools/packaging/packaging.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index e9e95447681..38db08dc65c 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -304,7 +304,7 @@ function Start-PSPackage { # Remove symbol files, xml document files. Remove-Item "$Source\*.pdb", "$Source\*.xml" -Force - if ($IsWindows) { + if ($Environment.IsWindows) { $Arguments = @{ PackageNameSuffix = "$NameSuffix-gc" PackageSourcePath = $Source From aacbc71a1c5e4dd17834db27f1cdecded049adf2 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Sat, 27 Feb 2021 10:22:08 -0800 Subject: [PATCH 09/22] Update file.wxs --- assets/wix/files.wxs | 212 ------------------------------------------- 1 file changed, 212 deletions(-) diff --git a/assets/wix/files.wxs b/assets/wix/files.wxs index 05a7446573a..f17575a0668 100644 --- a/assets/wix/files.wxs +++ b/assets/wix/files.wxs @@ -2713,165 +2713,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3932,59 +3773,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 68b953a4e0d9e02b9b05879d1cd6b6316a19d869 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Sat, 27 Feb 2021 10:54:41 -0800 Subject: [PATCH 10/22] Fix another build error --- .../azureDevOps/templates/windows-packaging.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml b/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml index 5482911bfdd..38251114dcb 100644 --- a/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml +++ b/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml @@ -40,12 +40,8 @@ jobs: ReleaseTagVar: $(ReleaseTagVar) - powershell: | - $pkgFilter = if ( '$(Architecture)' -eq 'arm' ) { - "arm32" - } - else { - '$(Architecture)' - } + $pkgFilter = if ( '$(Architecture)' -eq 'arm' ) { "arm32" } else { '$(Architecture)' } + if ($env:BuildConfiguration -eq 'minSize') { $pkgFilter += '-*' } $vstsCommandString = "vso[task.setvariable variable=PkgFilter]$pkgFilter" Write-Host ("sending " + $vstsCommandString) From fd7ff3dd0a82125b3a989a8630cf285cdeda20c4 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Sat, 27 Feb 2021 22:40:34 -0800 Subject: [PATCH 11/22] Build min-size package for Linux --- .../Images/GenericLinuxFiles/PowerShellPackage.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 index 9ace6f720aa..674a71f7da8 100644 --- a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 @@ -75,7 +75,10 @@ function BuildPackages { Start-PSPackage @releaseTagParam -LTS:$LTS } - if ($TarX64) { Start-PSPackage -Type tar @releaseTagParam -LTS:$LTS } + if ($TarX64) { + Start-PSPackage -Type tar @releaseTagParam -LTS:$LTS + Start-PSPackage -Type min-size @releaseTagParam -LTS:$LTS + } if ($TarArm) { ## Build 'linux-arm' and create 'tar.gz' package for it. From 6cde2f4b23ca524335d170250a719135e1d53ec6 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Sat, 6 Mar 2021 23:05:59 -0800 Subject: [PATCH 12/22] Upload the min-size package to separate container in Azure blob --- .../azureDevOps/templates/linux.yml | 28 +++++++++++++++++++ .../azureDevOps/templates/upload.yml | 13 ++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/tools/releaseBuild/azureDevOps/templates/linux.yml b/tools/releaseBuild/azureDevOps/templates/linux.yml index 2f47f76b0b1..1176451f9ff 100644 --- a/tools/releaseBuild/azureDevOps/templates/linux.yml +++ b/tools/releaseBuild/azureDevOps/templates/linux.yml @@ -104,6 +104,18 @@ jobs: itemPattern: '**/*.tar.gz' downloadPath: '$(System.ArtifactsDirectory)\finished' + - powershell: | + $minSizePkg = '$(System.ArtifactsDirectory)\finished\release\*-gc.tar.gz' + if (Test-Path -Path $minSizePkg) { + $minSizeDir = '$(System.ArtifactsDirectory)\finished\minSize' + New-Item -Path $minSizeDir -Type Directory -Force > $null + Move-Item -Path $minSizePkg -Destination $minSizeDir + ## Capture items in the target folder + Get-ChildItem -Path $minSizeDir + } + displayName: 'Move minSize package to separate folder' + condition: and(eq(variables['buildName'], 'DEB'),succeeded()) + - task: DownloadBuildArtifacts@0 displayName: 'Download rpm Artifacts copy' inputs: @@ -145,6 +157,22 @@ jobs: parameters: artifactPath: $(System.ArtifactsDirectory)\finished\release + # requires windows + - task: AzureFileCopy@4 + displayName: 'Upload to Azure - min-size package' + inputs: + SourcePath: '$(System.ArtifactsDirectory)\finished\minSize\*' + azureSubscription: '$(AzureFileCopySubscription)' + Destination: AzureBlob + storage: '$(StorageAccount)' + ContainerName: '$(AzureVersion)-gc' + condition: and(eq(variables['buildName'], 'DEB'),succeeded()) + + - template: upload-final-results.yml + parameters: + artifactPath: $(System.ArtifactsDirectory)\finished\minSize + condition: and(eq(variables['buildName'], 'DEB'),succeeded()) + # requires windows - task: AzureFileCopy@4 displayName: 'Upload to Azure - RPM - Unsigned' diff --git a/tools/releaseBuild/azureDevOps/templates/upload.yml b/tools/releaseBuild/azureDevOps/templates/upload.yml index 7f99e3d0c5c..d7d27329c7b 100644 --- a/tools/releaseBuild/azureDevOps/templates/upload.yml +++ b/tools/releaseBuild/azureDevOps/templates/upload.yml @@ -31,7 +31,7 @@ steps: - task: AzureFileCopy@4 displayName: 'upload signed zip to Azure - ${{ parameters.architecture }}' inputs: - SourcePath: '$(System.ArtifactsDirectory)\signed\PowerShell-${{ parameters.version }}-win-${{ parameters.architecture }}*.zip' + SourcePath: '$(System.ArtifactsDirectory)\signed\PowerShell-${{ parameters.version }}-win-${{ parameters.architecture }}.zip' azureSubscription: '$(AzureFileCopySubscription)' Destination: AzureBlob storage: '$(StorageAccount)' @@ -39,6 +39,17 @@ steps: resourceGroup: '$(StorageResourceGroup)' condition: succeeded() +- task: AzureFileCopy@4 + displayName: 'upload signed min-size package to Azure - ${{ parameters.architecture }}' + inputs: + SourcePath: '$(System.ArtifactsDirectory)\signed\PowerShell-${{ parameters.version }}-win-${{ parameters.architecture }}-gc.zip' + azureSubscription: '$(AzureFileCopySubscription)' + Destination: AzureBlob + storage: '$(StorageAccount)' + ContainerName: '$(AzureVersion)-gc' + resourceGroup: '$(StorageResourceGroup)' + condition: and(eq('${{ parameters.architecture }}', 'x64'), succeeded()) + - template: upload-final-results.yml parameters: artifactPath: $(System.ArtifactsDirectory)\signed From 40c2702dad4b2fc27a78089f79295ffac80acdcc Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Sun, 7 Mar 2021 12:38:20 -0800 Subject: [PATCH 13/22] Do not upload min-size package to the main Az blob container --- .../azureDevOps/templates/linux.yml | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/tools/releaseBuild/azureDevOps/templates/linux.yml b/tools/releaseBuild/azureDevOps/templates/linux.yml index 1176451f9ff..edf4a99a012 100644 --- a/tools/releaseBuild/azureDevOps/templates/linux.yml +++ b/tools/releaseBuild/azureDevOps/templates/linux.yml @@ -95,7 +95,7 @@ jobs: downloadType: specific itemPattern: '**/*.deb' downloadPath: '$(System.ArtifactsDirectory)\finished' - condition: and(eq(variables['buildName'], 'DEB'),succeeded()) + condition: and(eq(variables['buildName'], 'DEB'), succeeded()) - task: DownloadBuildArtifacts@0 displayName: 'Download tar.gz Artifacts copy' @@ -105,16 +105,29 @@ jobs: downloadPath: '$(System.ArtifactsDirectory)\finished' - powershell: | + Write-Host 'We handle the min-size package only when uploading for deb build.' + Write-Host 'For deb build, the min-size package is moved to a separate folder "finished\minSize",' + Write-Host 'so that the min-size package can be uploaded to a different Az Blob container.' + Write-Host 'For other builds, the min-size package is removed after being downloaded, so that it' + Write-Host 'doesn't get accidentally uploaded to the wrong Az Blob container.' + $minSizePkg = '$(System.ArtifactsDirectory)\finished\release\*-gc.tar.gz' if (Test-Path -Path $minSizePkg) { - $minSizeDir = '$(System.ArtifactsDirectory)\finished\minSize' - New-Item -Path $minSizeDir -Type Directory -Force > $null - Move-Item -Path $minSizePkg -Destination $minSizeDir - ## Capture items in the target folder - Get-ChildItem -Path $minSizeDir + if ('$(build)' -eq 'DEB') { + $minSizeDir = '$(System.ArtifactsDirectory)\finished\minSize' + New-Item -Path $minSizeDir -Type Directory -Force > $null + Move-Item -Path $minSizePkg -Destination $minSizeDir + + Write-Host "`nCapture the min-size package moved to the target folder." + Get-ChildItem -Path $minSizeDir + } else { + Write-Host '$(build): Remove the min-size package.' + Remove-Item -Path $minSizePkg -Force + } + } else { + Write-Host 'min-size package not found, so skip this step.' } displayName: 'Move minSize package to separate folder' - condition: and(eq(variables['buildName'], 'DEB'),succeeded()) - task: DownloadBuildArtifacts@0 displayName: 'Download rpm Artifacts copy' @@ -122,7 +135,7 @@ jobs: downloadType: specific itemPattern: '**/*.rpm' downloadPath: '$(System.ArtifactsDirectory)\rpm' - condition: and(eq(variables['buildName'], 'RPM'),succeeded()) + condition: and(eq(variables['buildName'], 'RPM'), succeeded()) - template: EsrpScan.yml@ComplianceRepo parameters: @@ -166,12 +179,12 @@ jobs: Destination: AzureBlob storage: '$(StorageAccount)' ContainerName: '$(AzureVersion)-gc' - condition: and(eq(variables['buildName'], 'DEB'),succeeded()) + condition: and(eq(variables['buildName'], 'DEB'), succeeded()) - template: upload-final-results.yml parameters: artifactPath: $(System.ArtifactsDirectory)\finished\minSize - condition: and(eq(variables['buildName'], 'DEB'),succeeded()) + condition: and(eq(variables['buildName'], 'DEB'), succeeded()) # requires windows - task: AzureFileCopy@4 From e7d621854de391b862bccd5567e87377f2bc0492 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Sun, 7 Mar 2021 13:20:20 -0800 Subject: [PATCH 14/22] Fix a typo --- tools/releaseBuild/azureDevOps/templates/linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/releaseBuild/azureDevOps/templates/linux.yml b/tools/releaseBuild/azureDevOps/templates/linux.yml index edf4a99a012..970304e4b8d 100644 --- a/tools/releaseBuild/azureDevOps/templates/linux.yml +++ b/tools/releaseBuild/azureDevOps/templates/linux.yml @@ -121,7 +121,7 @@ jobs: Write-Host "`nCapture the min-size package moved to the target folder." Get-ChildItem -Path $minSizeDir } else { - Write-Host '$(build): Remove the min-size package.' + Write-Host '$(build) -- Remove the min-size package.' Remove-Item -Path $minSizePkg -Force } } else { From 5fa96aef1f21e4b3509dd0564063d740892dbd06 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 8 Mar 2021 07:47:22 +0000 Subject: [PATCH 15/22] Updated linux.yml --- tools/releaseBuild/azureDevOps/templates/linux.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/releaseBuild/azureDevOps/templates/linux.yml b/tools/releaseBuild/azureDevOps/templates/linux.yml index 970304e4b8d..a872110e754 100644 --- a/tools/releaseBuild/azureDevOps/templates/linux.yml +++ b/tools/releaseBuild/azureDevOps/templates/linux.yml @@ -118,10 +118,8 @@ jobs: New-Item -Path $minSizeDir -Type Directory -Force > $null Move-Item -Path $minSizePkg -Destination $minSizeDir - Write-Host "`nCapture the min-size package moved to the target folder." Get-ChildItem -Path $minSizeDir } else { - Write-Host '$(build) -- Remove the min-size package.' Remove-Item -Path $minSizePkg -Force } } else { From 290f88f3f3ceebc7f52ca7321dcb9d7a7fbde591 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 8 Mar 2021 09:50:15 -0800 Subject: [PATCH 16/22] Fix the parsing error --- .../azureDevOps/templates/linux.yml | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/tools/releaseBuild/azureDevOps/templates/linux.yml b/tools/releaseBuild/azureDevOps/templates/linux.yml index a872110e754..d56ba910414 100644 --- a/tools/releaseBuild/azureDevOps/templates/linux.yml +++ b/tools/releaseBuild/azureDevOps/templates/linux.yml @@ -106,23 +106,31 @@ jobs: - powershell: | Write-Host 'We handle the min-size package only when uploading for deb build.' - Write-Host 'For deb build, the min-size package is moved to a separate folder "finished\minSize",' - Write-Host 'so that the min-size package can be uploaded to a different Az Blob container.' - Write-Host 'For other builds, the min-size package is removed after being downloaded, so that it' - Write-Host 'doesn't get accidentally uploaded to the wrong Az Blob container.' + Write-Host '- For deb build, the min-size package is moved to a separate folder "finished\minSize",' + Write-Host ' so that the min-size package can be uploaded to a different Az Blob container.' + Write-Host '- For other builds, the min-size package is removed after being downloaded, so that it' + Write-Host ' does not get accidentally uploaded to the wrong Az Blob container.' $minSizePkg = '$(System.ArtifactsDirectory)\finished\release\*-gc.tar.gz' - if (Test-Path -Path $minSizePkg) { - if ('$(build)' -eq 'DEB') { + if (Test-Path -Path $minSizePkg) + { + if ('$(build)' -eq 'DEB') + { $minSizeDir = '$(System.ArtifactsDirectory)\finished\minSize' New-Item -Path $minSizeDir -Type Directory -Force > $null Move-Item -Path $minSizePkg -Destination $minSizeDir + Write-Host "`nCapture the min-size package moved to the target folder." Get-ChildItem -Path $minSizeDir - } else { + } + else + { + Write-Host '$(build): Remove the min-size package.' Remove-Item -Path $minSizePkg -Force } - } else { + } + else + { Write-Host 'min-size package not found, so skip this step.' } displayName: 'Move minSize package to separate folder' From 0f439d72c6282526485c0f352e48fa42ce75c302 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 8 Mar 2021 10:46:24 -0800 Subject: [PATCH 17/22] Fix the variable name --- tools/releaseBuild/azureDevOps/templates/linux.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/releaseBuild/azureDevOps/templates/linux.yml b/tools/releaseBuild/azureDevOps/templates/linux.yml index d56ba910414..a6411591f22 100644 --- a/tools/releaseBuild/azureDevOps/templates/linux.yml +++ b/tools/releaseBuild/azureDevOps/templates/linux.yml @@ -114,7 +114,7 @@ jobs: $minSizePkg = '$(System.ArtifactsDirectory)\finished\release\*-gc.tar.gz' if (Test-Path -Path $minSizePkg) { - if ('$(build)' -eq 'DEB') + if ('$(buildName)' -eq 'DEB') { $minSizeDir = '$(System.ArtifactsDirectory)\finished\minSize' New-Item -Path $minSizeDir -Type Directory -Force > $null @@ -125,7 +125,7 @@ jobs: } else { - Write-Host '$(build): Remove the min-size package.' + Write-Host '$(buildName): Remove the min-size package.' Remove-Item -Path $minSizePkg -Force } } From 9c5446889b6ef29cc081b0a86de8ae001288c4fe Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 8 Mar 2021 12:39:34 -0800 Subject: [PATCH 18/22] Fix min-size build for Linux --- .../Images/GenericLinuxFiles/PowerShellPackage.ps1 | 10 ++++++++-- tools/releaseBuild/build.json | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 index 674a71f7da8..4cd0418de94 100644 --- a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 @@ -18,6 +18,7 @@ param ( [switch]$TarX64, [switch]$TarArm, [switch]$TarArm64, + [switch]$TarMinSize, [switch]$FxDependent, [switch]$Alpine ) @@ -75,8 +76,13 @@ function BuildPackages { Start-PSPackage @releaseTagParam -LTS:$LTS } - if ($TarX64) { - Start-PSPackage -Type tar @releaseTagParam -LTS:$LTS + if ($TarX64) { Start-PSPackage -Type tar @releaseTagParam -LTS:$LTS } + + if ($TarMinSize) { + ## Build 'min-size' and create 'tar.gz' package for it. + $buildParams['Crossgen'] = $false + $buildParams['ForMinimalSize'] = $true + Start-PSBuild @buildParams @releaseTagParam Start-PSPackage -Type min-size @releaseTagParam -LTS:$LTS } diff --git a/tools/releaseBuild/build.json b/tools/releaseBuild/build.json index 87d6753bcac..fe2f9d96f17 100644 --- a/tools/releaseBuild/build.json +++ b/tools/releaseBuild/build.json @@ -295,7 +295,7 @@ { "Name": "deb", "RepoDestinationPath": "/PowerShell", - "BuildCommand": "/PowerShellPackage.ps1 -location _RepoDestinationPath_ -destination _DockerVolume_ -ReleaseTag _ReleaseTag_ -TarX64 -TarArm -TarArm64", + "BuildCommand": "/PowerShellPackage.ps1 -location _RepoDestinationPath_ -destination _DockerVolume_ -ReleaseTag _ReleaseTag_ -TarX64 -TarArm -TarArm64 -TarMinSize", "DockerFile": "./tools/releaseBuild/Images/microsoft_powershell_ubuntu18.04/Dockerfile", "AdditionalContextFiles" :[ "./tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1"], "DockerImageName": "ps-ubunutu-18-04", From 3c8805dbb2b6ebb65d0982db2863b81f117963c2 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 8 Mar 2021 14:49:33 -0800 Subject: [PATCH 19/22] Attempt to fix the linux min-size build --- .../Images/GenericLinuxFiles/PowerShellPackage.ps1 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 index 4cd0418de94..95d0051faea 100644 --- a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 @@ -67,6 +67,7 @@ function BuildPackages { } Start-PSBuild @buildParams @releaseTagParam + $options = Get-PSOptions if ($FxDependent) { Start-PSPackage -Type 'fxdependent' @releaseTagParam -LTS:$LTS @@ -79,9 +80,19 @@ function BuildPackages { if ($TarX64) { Start-PSPackage -Type tar @releaseTagParam -LTS:$LTS } if ($TarMinSize) { + Write-Host "---- Min-Size ----" + Write-Host "options.Output: " + $options.Output + Write-Host "options.Top " + $options.Top + + $binDir = Join-Path -Path $options.Top -ChildPath 'bin' + Write-Host "Remove $binDir" + Remove-Item -Path $binDir -Recurse -Force + ## Build 'min-size' and create 'tar.gz' package for it. $buildParams['Crossgen'] = $false $buildParams['ForMinimalSize'] = $true + Write-Host ($buildParams | Out-String) + Start-PSBuild @buildParams @releaseTagParam Start-PSPackage -Type min-size @releaseTagParam -LTS:$LTS } From 7bb5ba264efe0f28359ea3af15968477f5794ad1 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 8 Mar 2021 15:13:29 -0800 Subject: [PATCH 20/22] Update the log messages --- .../Images/GenericLinuxFiles/PowerShellPackage.ps1 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 index 95d0051faea..011b219ea3f 100644 --- a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 @@ -81,18 +81,16 @@ function BuildPackages { if ($TarMinSize) { Write-Host "---- Min-Size ----" - Write-Host "options.Output: " + $options.Output - Write-Host "options.Top " + $options.Top + Write-Host "options.Output: $($options.Output)" + Write-Host "options.Top $($options.Top)" $binDir = Join-Path -Path $options.Top -ChildPath 'bin' - Write-Host "Remove $binDir" + Write-Host "Remove $binDir, to get a clean build for min-size package" Remove-Item -Path $binDir -Recurse -Force ## Build 'min-size' and create 'tar.gz' package for it. $buildParams['Crossgen'] = $false $buildParams['ForMinimalSize'] = $true - Write-Host ($buildParams | Out-String) - Start-PSBuild @buildParams @releaseTagParam Start-PSPackage -Type min-size @releaseTagParam -LTS:$LTS } From a8ed57d97c5a74777d81a751c20fd6fa5286770d Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 8 Mar 2021 21:47:05 -0800 Subject: [PATCH 21/22] Address comments --- assets/wix/files.wxs | 212 ++++++++++++++++++ build.psm1 | 14 +- src/powershell-unix/powershell-unix.csproj | 5 + .../powershell-win-core.csproj | 5 + tools/packaging/packaging.psm1 | 4 +- .../GenericLinuxFiles/PowerShellPackage.ps1 | 8 +- .../PowerShellPackage.ps1 | 37 ++- .../templates/windows-hosted-build.yml | 6 +- .../templates/windows-packaging.yml | 6 +- 9 files changed, 260 insertions(+), 37 deletions(-) diff --git a/assets/wix/files.wxs b/assets/wix/files.wxs index f17575a0668..05a7446573a 100644 --- a/assets/wix/files.wxs +++ b/assets/wix/files.wxs @@ -2713,6 +2713,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3773,6 +3932,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build.psm1 b/build.psm1 index 8e1737fbd2c..f3cd02df948 100644 --- a/build.psm1 +++ b/build.psm1 @@ -322,12 +322,14 @@ function Start-PSBuild { throw "Cross compiling for win-arm or win-arm64 is only supported on Windows environment" } - if ($ForMinimalSize -and $Runtime -and "linux-x64", "win7-x64", "osx-x64" -notcontains $Runtime) { - throw "Build for the minimal size is enabled only for following runtimes: 'linux-x64', 'win7-x64', 'osx-x64'" - } + if ($ForMinimalSize) { + if ($CrossGen) { + throw "Build for the minimal size requires the minimal disk footprint, so `CrossGen` is not allowed" + } - if ($ForMinimalSize -and $CrossGen) { - throw "Build for the minimal size requires the minimal disk footprint, so `CrossGen` is not allowed" + if ($Runtime -and "linux-x64", "win7-x64", "osx-x64" -notcontains $Runtime) { + throw "Build for the minimal size is enabled only for following runtimes: 'linux-x64', 'win7-x64', 'osx-x64'" + } } function Stop-DevPowerShell { @@ -479,6 +481,8 @@ Fix steps: if ($Options.Runtime -notlike 'fxdependent*') { $sdkToUse = 'Microsoft.NET.Sdk' if ($Options.Runtime -like 'win7-*' -and !$ForMinimalSize) { + ## WPF/WinForm and the PowerShell GraphicalHost assemblies are included + ## when 'Microsoft.NET.Sdk.WindowsDesktop' is used. $sdkToUse = 'Microsoft.NET.Sdk.WindowsDesktop' } diff --git a/src/powershell-unix/powershell-unix.csproj b/src/powershell-unix/powershell-unix.csproj index 91edefea62b..802acf05e3a 100644 --- a/src/powershell-unix/powershell-unix.csproj +++ b/src/powershell-unix/powershell-unix.csproj @@ -19,6 +19,11 @@ PreserveNewest PreserveNewest + + Schemas\PSMaml\%(FileName)%(Extension) + PreserveNewest + PreserveNewest + PreserveNewest PreserveNewest diff --git a/src/powershell-win-core/powershell-win-core.csproj b/src/powershell-win-core/powershell-win-core.csproj index 939386cc909..16f625827d4 100644 --- a/src/powershell-win-core/powershell-win-core.csproj +++ b/src/powershell-win-core/powershell-win-core.csproj @@ -24,6 +24,11 @@ PreserveNewest PreserveNewest + + Schemas\PSMaml\%(FileName)%(Extension) + PreserveNewest + PreserveNewest + PreserveNewest PreserveNewest diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 38db08dc65c..ce79267fb19 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -316,7 +316,7 @@ function Start-PSPackage { New-ZipPackage @Arguments } } - elseif ($IsLinux) { + elseif ($Environment.IsLinux) { $Arguments = @{ PackageSourcePath = $Source Name = $Name @@ -347,7 +347,7 @@ function Start-PSPackage { if ($PSCmdlet.ShouldProcess("Create Zip Package")) { New-ZipPackage @Arguments } - } elseif ($IsLinux) { + } elseif ($Environment.IsLinux) { $Arguments = @{ PackageSourcePath = $Source Name = $Name diff --git a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 index 011b219ea3f..e129ea19f36 100644 --- a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 @@ -80,12 +80,12 @@ function BuildPackages { if ($TarX64) { Start-PSPackage -Type tar @releaseTagParam -LTS:$LTS } if ($TarMinSize) { - Write-Host "---- Min-Size ----" - Write-Host "options.Output: $($options.Output)" - Write-Host "options.Top $($options.Top)" + Write-Verbose -Verbose "---- Min-Size ----" + Write-Verbose -Verbose "options.Output: $($options.Output)" + Write-Verbose -Verbose "options.Top $($options.Top)" $binDir = Join-Path -Path $options.Top -ChildPath 'bin' - Write-Host "Remove $binDir, to get a clean build for min-size package" + Write-Verbose -Verbose "Remove $binDir, to get a clean build for min-size package" Remove-Item -Path $binDir -Recurse -Force ## Build 'min-size' and create 'tar.gz' package for it. diff --git a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 index 60842bab979..a893cf0c928 100644 --- a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 @@ -14,8 +14,7 @@ param ( [ValidateSet("win7-x64", "win7-x86", "win-arm", "win-arm64", "fxdependent", "fxdependent-win-desktop")] [string] $Runtime = 'win7-x64', - [ValidateSet("min-size")] - [string] $Configuration = '', + [switch] $ForMinimalSize, [switch] $Wait, @@ -28,7 +27,7 @@ param ( [Parameter(Mandatory,ParameterSetName='packageSigned')] [ValidatePattern("-signed.zip$")] - [string]$BuildZip, + [string] $BuildZip, [Parameter(Mandatory,ParameterSetName='ComponentRegistration')] [switch] $ComponentRegistration @@ -97,9 +96,12 @@ try else { Write-Verbose "Starting powershell build for RID: $Runtime and ReleaseTag: $ReleaseTag ..." -Verbose - $buildParams = @{'CrossGen'= $Runtime -notmatch "arm" -and $Runtime -notlike "fxdependent*" -and !$Configuration} + $buildParams = @{ + CrossGen = !$ForMinimalSize -and $Runtime -notmatch "arm" -and $Runtime -notlike "fxdependent*" + ForMinimalSize = $ForMinimalSize + } - if($Symbols.IsPresent) + if($Symbols) { $buildParams['NoPSModuleRestore'] = $true } @@ -108,15 +110,10 @@ try $buildParams['PSModuleRestore'] = $true } - if ($Configuration -eq 'min-size') - { - $buildParams['ForMinimalSize'] = $true - } - Start-PSBuild -Clean -Runtime $Runtime -Configuration Release @releaseTagParam @buildParams } - if ($ComponentRegistration.IsPresent) + if ($ComponentRegistration) { Write-Verbose "Exporting project.assets files ..." -Verbose @@ -127,7 +124,7 @@ try $subfolder = $_.FullName.Replace($location,'') $subfolder.Replace('project.assets.json','') $itemDestination = Join-Path -Path $projectAssetsFolder -ChildPath $subfolder - New-Item -Path $itemDestination -ItemType Directory -Force + New-Item -Path $itemDestination -ItemType Directory -Force > $null $file = $_.FullName Write-Verbose "Copying $file to $itemDestination" -Verbose Copy-Item -Path $file -Destination "$itemDestination\" -Force @@ -148,14 +145,14 @@ try { ## Set the default package type. $pspackageParams = @{'Type' = 'msi'; 'WindowsRuntime' = $Runtime} - if ($Configuration -eq 'min-size') + if ($ForMinimalSize) { ## Special case for the minimal size self-contained package. - $pspackageParams['Type'] = $Configuration + $pspackageParams['Type'] = 'min-size' } } - if (!$Symbols.IsPresent -and $Runtime -notlike 'fxdependent*' -and !$Configuration) + if (!$Symbols -and $Runtime -notlike 'fxdependent*' -and !$ForMinimalSize) { if ($Runtime -notmatch 'arm') { @@ -168,10 +165,10 @@ try Start-PSPackage @pspackageParams @releaseTagParam } - if ($Runtime -like 'fxdependent*' -or $Configuration -eq 'min-size') + if ($Runtime -like 'fxdependent*' -or $ForMinimalSize) { ## Add symbols for just like zip package. - $pspackageParams['IncludeSymbols']=$Symbols.IsPresent + $pspackageParams['IncludeSymbols']=$Symbols Start-PSPackage @pspackageParams @releaseTagParam ## Copy the fxdependent Zip package to destination. @@ -183,14 +180,14 @@ try } else { - if (!$Symbols.IsPresent) { + if (!$Symbols) { $pspackageParams['Type'] = 'zip-pdb' Write-Verbose "Starting powershell symbols packaging(zip)..." -Verbose Start-PSPackage @pspackageParams @releaseTagParam } $pspackageParams['Type']='zip' - $pspackageParams['IncludeSymbols']=$Symbols.IsPresent + $pspackageParams['IncludeSymbols']=$Symbols Write-Verbose "Starting powershell packaging(zip)..." -Verbose Start-PSPackage @pspackageParams @releaseTagParam @@ -206,7 +203,7 @@ try finally { Write-Verbose "Beginning build clean-up..." -Verbose - if ($Wait.IsPresent) + if ($Wait) { $path = Join-Path $PSScriptRoot -ChildPath 'delete-to-continue.txt' $null = New-Item -Path $path -ItemType File diff --git a/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml b/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml index 37b1953f094..2c5f4cc138d 100644 --- a/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml +++ b/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml @@ -56,12 +56,12 @@ jobs: "fxdependentWinDesktop" { "fxdependent-win-desktop" } } - $configuration = @{} + $params = @{} if ($env:BuildConfiguration -eq 'minSize') { - $configuration['Configuration'] = 'min-size' + $params['ForMinimalSize'] = $true } - tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 -location '$(PowerShellRoot)' -destination '$(Build.ArtifactStagingDirectory)/Symbols_$(Architecture)' -Runtime $runtime -ReleaseTag '$(ReleaseTagVar)' -Symbols @configuration + tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 -location '$(PowerShellRoot)' -destination '$(Build.ArtifactStagingDirectory)/Symbols_$(Architecture)' -Runtime $runtime -ReleaseTag '$(ReleaseTagVar)' -Symbols @params displayName: 'Build Windows Universal - $(Architecture)-$(BuildConfiguration) Symbols zip' - powershell: | diff --git a/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml b/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml index 38251114dcb..08a05a1a17e 100644 --- a/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml +++ b/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml @@ -247,12 +247,12 @@ jobs: $signedPkg = "$(BuildPackagePath)" Write-Verbose -Verbose -Message "signedPkg = $signedPkg" - $configuration = @{} + $params = @{} if ($env:BuildConfiguration -eq 'minSize') { - $configuration['Configuration'] = 'min-size' + $params['ForMinimalSize'] = $true } - $(PowerShellRoot)/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 -BuildZip $signedPkg -location '$(PowerShellRoot)' -destination '$(System.ArtifactsDirectory)\pkgSigned' -Runtime $runtime -ReleaseTag '$(ReleaseTagVar)' @configuration + $(PowerShellRoot)/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 -BuildZip $signedPkg -location '$(PowerShellRoot)' -destination '$(System.ArtifactsDirectory)\pkgSigned' -Runtime $runtime -ReleaseTag '$(ReleaseTagVar)' @params displayName: 'Build Windows Universal - $(Architecture) Package' - powershell: | From 3335d09ba6bbfff649a6e75de78041531a43e0cd Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Tue, 9 Mar 2021 14:52:29 -0800 Subject: [PATCH 22/22] Address more feedback --- tools/packaging/packaging.psm1 | 1 + tools/releaseBuild/azureDevOps/templates/linux.yml | 2 +- tools/releaseBuild/azureDevOps/templates/upload.yml | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index ce79267fb19..2c21c8e0344 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -304,6 +304,7 @@ function Start-PSPackage { # Remove symbol files, xml document files. Remove-Item "$Source\*.pdb", "$Source\*.xml" -Force + # Add suffix '-gc' because this package is for the Guest Config team. if ($Environment.IsWindows) { $Arguments = @{ PackageNameSuffix = "$NameSuffix-gc" diff --git a/tools/releaseBuild/azureDevOps/templates/linux.yml b/tools/releaseBuild/azureDevOps/templates/linux.yml index a6411591f22..5954b080bf7 100644 --- a/tools/releaseBuild/azureDevOps/templates/linux.yml +++ b/tools/releaseBuild/azureDevOps/templates/linux.yml @@ -178,7 +178,7 @@ jobs: # requires windows - task: AzureFileCopy@4 - displayName: 'Upload to Azure - min-size package' + displayName: 'Upload to Azure - min-size package for Guest Config' inputs: SourcePath: '$(System.ArtifactsDirectory)\finished\minSize\*' azureSubscription: '$(AzureFileCopySubscription)' diff --git a/tools/releaseBuild/azureDevOps/templates/upload.yml b/tools/releaseBuild/azureDevOps/templates/upload.yml index d7d27329c7b..580ee279e89 100644 --- a/tools/releaseBuild/azureDevOps/templates/upload.yml +++ b/tools/releaseBuild/azureDevOps/templates/upload.yml @@ -40,7 +40,7 @@ steps: condition: succeeded() - task: AzureFileCopy@4 - displayName: 'upload signed min-size package to Azure - ${{ parameters.architecture }}' + displayName: 'upload signed min-size package (for Guest Config) to Azure - ${{ parameters.architecture }}' inputs: SourcePath: '$(System.ArtifactsDirectory)\signed\PowerShell-${{ parameters.version }}-win-${{ parameters.architecture }}-gc.zip' azureSubscription: '$(AzureFileCopySubscription)'