From d4811f97cd5b3b880a4a9e0321f5b0d284868970 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 28 Jan 2022 11:54:21 -0800 Subject: [PATCH 01/10] Update build.psm1 to statically get list of experimental features --- ExperimentalFeatures.json | 11 +++++++ build.psm1 | 61 +++++++++++++++++++++++---------------- 2 files changed, 47 insertions(+), 25 deletions(-) create mode 100644 ExperimentalFeatures.json diff --git a/ExperimentalFeatures.json b/ExperimentalFeatures.json new file mode 100644 index 00000000000..69f037f0d8a --- /dev/null +++ b/ExperimentalFeatures.json @@ -0,0 +1,11 @@ +[ + "PSAnsiRenderingFileInfo", + "PSCleanBlock", + "PSCommandNotFoundSuggestion", + "PSLoadAssemblyFromNativeCode", + "PSNativeCommandArgumentPassing", + "PSNativeCommandErrorActionPreference", + "PSNativePSPathResolution", + "PSRemotingSSHTransportErrorHandling", + "PSSubsystemPluginModel" +] diff --git a/build.psm1 b/build.psm1 index 49609675a20..6a4c9baf3cb 100644 --- a/build.psm1 +++ b/build.psm1 @@ -324,7 +324,8 @@ function Start-PSBuild { [switch]$Detailed, [switch]$InteractiveAuth, [switch]$SkipRoslynAnalyzers, - [string]$PSOptionsPath + [string]$PSOptionsPath, + [string]$ExperimentalFeatureJsonFilePath ) if ($ReleaseTag -and $ReleaseTag -notmatch "^v\d+\.\d+\.\d+(-(preview|rc)(\.\d{1,2})?)?$") { @@ -624,35 +625,45 @@ Fix steps: "WindowsPowerShellCompatibilityModuleDenyList" = @("PSScheduledJob","BestPractices","UpdateServices") } } - # When building preview, we want the configuration to enable all experiemental features by default - # ARM is cross compiled, so we can't run pwsh to enumerate Experimental Features - if (-not $SkipExperimentalFeatureGeneration -and + if ($ExperimentalFeatureJsonFilePath) { + if (-not (Test-Path $ExperimentalFeatureJsonFilePath)) { + throw "ExperimentalFeatureJsonFilePath: $ExperimentalFeatureJsonFilePath does not exist" + } + + $json = Get-Content -Raw $ExperimentalFeatureJsonFilePath + $config += @{ ExperimentalFeatures = ([string[]] ($json | ConvertFrom-Json)) } + } + else { + # When building preview, we want the configuration to enable all experiemental features by default + # ARM is cross compiled, so we can't run pwsh to enumerate Experimental Features + if (-not $SkipExperimentalFeatureGeneration -and (Test-IsPreview $psVersion) -and - -not (Test-IsReleaseCandidate $psVersion) -and - -not $Runtime.Contains("arm") -and - -not ($Runtime -like 'fxdependent*')) { - - $json = & $publishPath\pwsh -noprofile -command { - # Special case for DSC code in PS; - # this experimental feature requires new DSC module that is not inbox, - # so we don't want default DSC use case be broken - [System.Collections.ArrayList] $expFeatures = Get-ExperimentalFeature | Where-Object Name -NE PS7DscSupport | ForEach-Object -MemberName Name - - $expFeatures | Out-String | Write-Verbose -Verbose - - # Make sure ExperimentalFeatures from modules in PSHome are added - # https://github.com/PowerShell/PowerShell/issues/10550 - $ExperimentalFeaturesFromGalleryModulesInPSHome = @() - $ExperimentalFeaturesFromGalleryModulesInPSHome | ForEach-Object { - if (!$expFeatures.Contains($_)) { - $null = $expFeatures.Add($_) + -not (Test-IsReleaseCandidate $psVersion) -and + -not $Runtime.Contains("arm") -and + -not ($Runtime -like 'fxdependent*')) { + + $json = & $publishPath\pwsh -noprofile -command { + # Special case for DSC code in PS; + # this experimental feature requires new DSC module that is not inbox, + # so we don't want default DSC use case be broken + [System.Collections.ArrayList] $expFeatures = Get-ExperimentalFeature | Where-Object Name -NE PS7DscSupport | ForEach-Object -MemberName Name + + $expFeatures | Out-String | Write-Verbose -Verbose + + # Make sure ExperimentalFeatures from modules in PSHome are added + # https://github.com/PowerShell/PowerShell/issues/10550 + $ExperimentalFeaturesFromGalleryModulesInPSHome = @() + $ExperimentalFeaturesFromGalleryModulesInPSHome | ForEach-Object { + if (!$expFeatures.Contains($_)) { + $null = $expFeatures.Add($_) + } } + + ConvertTo-Json $expFeatures } - ConvertTo-Json $expFeatures + $config += @{ ExperimentalFeatures = ([string[]] ($json | ConvertFrom-Json)) } } - - $config += @{ ExperimentalFeatures = ([string[]] ($json | ConvertFrom-Json)) } } if ($config.Count -gt 0) { From 79a48f825f6d4ce7ac043cf466fb353b84f678e6 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 28 Jan 2022 14:31:07 -0800 Subject: [PATCH 02/10] Update all calls to Start-PSBuild --- tools/UpdateDotnetRuntime.ps1 | 2 +- tools/ci.psm1 | 12 ++++++------ tools/packaging/packaging.psm1 | 6 +++--- .../Images/GenericLinuxFiles/PowerShellPackage.ps1 | 6 +++--- .../PowerShellPackage.ps1 | 1 + tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 | 4 ++-- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/tools/UpdateDotnetRuntime.ps1 b/tools/UpdateDotnetRuntime.ps1 index 6747368a4c6..a6a4610e6f5 100644 --- a/tools/UpdateDotnetRuntime.ps1 +++ b/tools/UpdateDotnetRuntime.ps1 @@ -342,7 +342,7 @@ if ($dotnetUpdate.ShouldUpdate) { Import-Module "$PSScriptRoot/../build.psm1" -Force Import-Module "$PSScriptRoot/packaging" -Force Start-PSBootstrap -Package - Start-PSBuild -Clean -Configuration Release -CrossGen -InteractiveAuth:$InteractiveAuth + Start-PSBuild -Clean -Configuration Release -CrossGen -InteractiveAuth:$InteractiveAuth -ExperimentalFeatureJsonFilePath "$PSScriptRoot/../ExperimentalFeatures.json" $publishPath = Split-Path (Get-PSOutput) Remove-Item -Path "$publishPath\*.pdb" diff --git a/tools/ci.psm1 b/tools/ci.psm1 index f4ed3c78945..7431a41c2ff 100644 --- a/tools/ci.psm1 +++ b/tools/ci.psm1 @@ -96,10 +96,10 @@ function Invoke-CIBuild if(Test-DailyBuild) { - Start-PSBuild -Configuration 'CodeCoverage' -PSModuleRestore -CI -ReleaseTag $releaseTag + Start-PSBuild -Configuration 'CodeCoverage' -PSModuleRestore -CI -ReleaseTag $releaseTag -ExperimentalFeatureJsonFilePath "$PSScriptRoot\..\ExperimentalFeatures.json" } - Start-PSBuild -PSModuleRestore -Configuration 'Release' -CI -ReleaseTag $releaseTag + Start-PSBuild -PSModuleRestore -Configuration 'Release' -CI -ReleaseTag $releaseTag -ExperimentalFeatureJsonFilePath "$PSScriptRoot\..\ExperimentalFeatures.json" Save-PSOptions $options = (Get-PSOptions) @@ -347,7 +347,7 @@ function New-CodeCoverageAndTestPackage { Start-PSBootstrap -Verbose - Start-PSBuild -Configuration 'CodeCoverage' -Clean + Start-PSBuild -Configuration 'CodeCoverage' -Clean -ExperimentalFeatureJsonFilePath "$PSScriptRoot\..\ExperimentalFeatures.json" $codeCoverageOutput = Split-Path -Parent (Get-PSOutput) $codeCoverageArtifacts = Compress-CoverageArtifacts -CodeCoverageOutput $codeCoverageOutput @@ -471,7 +471,7 @@ function Invoke-CIFinish $prereleaseIteration = (get-date).Day $preReleaseVersion = "$previewPrefix-$previewLabel.$prereleaseIteration" # Build clean before backing to remove files from testing - Start-PSBuild -PSModuleRestore -Configuration 'Release' -ReleaseTag $preReleaseVersion -Clean -Runtime $Runtime -output $buildFolder -PSOptionsPath "${buildFolder}/psoptions.json" + Start-PSBuild -PSModuleRestore -Configuration 'Release' -ReleaseTag $preReleaseVersion -Clean -Runtime $Runtime -output $buildFolder -PSOptionsPath "${buildFolder}/psoptions.json" -ExperimentalFeatureJsonFilePath "$PSScriptRoot\..\ExperimentalFeatures.json" $options = Get-PSOptions # Remove symbol files. $filter = Join-Path -Path (Split-Path $options.Output) -ChildPath '*.pdb' @@ -482,7 +482,7 @@ function Invoke-CIFinish $releaseTagParts = $releaseTag.split('.') $preReleaseVersion = $releaseTagParts[0]+ ".9.9" Write-Verbose "newPSReleaseTag: $preReleaseVersion" -Verbose - Start-PSBuild -PSModuleRestore -Configuration 'Release' -ReleaseTag $preReleaseVersion -Clean -Runtime $Runtime -output $buildFolder -PSOptionsPath "${buildFolder}/psoptions.json" + Start-PSBuild -PSModuleRestore -Configuration 'Release' -ReleaseTag $preReleaseVersion -Clean -Runtime $Runtime -output $buildFolder -PSOptionsPath "${buildFolder}/psoptions.json" -ExperimentalFeatureJsonFilePath "$PSScriptRoot\..\ExperimentalFeatures.json" $options = Get-PSOptions # Remove symbol files. $filter = Join-Path -Path (Split-Path $options.Output) -ChildPath '*.pdb' @@ -760,7 +760,7 @@ function New-LinuxPackage if ($IsLinux) { # Create and package Raspbian .tgz - Start-PSBuild -PSModuleRestore -Clean -Runtime linux-arm -Configuration 'Release' + Start-PSBuild -PSModuleRestore -Clean -Runtime linux-arm -Configuration 'Release' -ExperimentalFeatureJsonFilePath "$PSScriptRoot\..\ExperimentalFeatures.json" $armPackage = Start-PSPackage @packageParams -Type tar-arm -SkipReleaseChecks Copy-Item $armPackage -Destination "${env:BUILD_ARTIFACTSTAGINGDIRECTORY}" -Force } diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 929d7868a44..a83c6906fcc 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -4328,7 +4328,7 @@ function Invoke-AzDevOpsLinuxPackageBuild { $releaseTagParam = @{ 'ReleaseTag' = $ReleaseTag } - $buildParams = @{ Configuration = 'Release'; PSModuleRestore = $true; Restore = $true } + $buildParams = @{ Configuration = 'Release'; PSModuleRestore = $true; Restore = $true; ExperimentalFeatureJsonFilePath = "$PSScriptRoot/../../ExperimentalFeatures.json" } switch ($BuildType) { 'fxdependent' { @@ -4368,12 +4368,12 @@ function Invoke-AzDevOpsLinuxPackageBuild { ## Build 'linux-arm' and create 'tar.gz' package for it. ## Note that 'linux-arm' can only be built on Ubuntu environment. $buildFolder = "${env:SYSTEM_ARTIFACTSDIRECTORY}/${arm32LinuxBuildFolder}" - Start-PSBuild -Configuration Release -Restore -Runtime linux-arm -PSModuleRestore @releaseTagParam -Output $buildFolder -PSOptionsPath "${buildFolder}-meta/psoptions.json" + Start-PSBuild -Configuration Release -Restore -Runtime linux-arm -PSModuleRestore @releaseTagParam -Output $buildFolder -PSOptionsPath "${buildFolder}-meta/psoptions.json" -ExperimentalFeatureJsonFilePath "$PSScriptRoot\..\ExperimentalFeatures.json" # Remove symbol files. Remove-Item "${buildFolder}\*.pdb" -Force $buildFolder = "${env:SYSTEM_ARTIFACTSDIRECTORY}/${arm64LinuxBuildFolder}" - Start-PSBuild -Configuration Release -Restore -Runtime linux-arm64 -PSModuleRestore @releaseTagParam -Output $buildFolder -PSOptionsPath "${buildFolder}-meta/psoptions.json" + Start-PSBuild -Configuration Release -Restore -Runtime linux-arm64 -PSModuleRestore @releaseTagParam -Output $buildFolder -PSOptionsPath "${buildFolder}-meta/psoptions.json" -ExperimentalFeatureJsonFilePath "$PSScriptRoot\..\ExperimentalFeatures.json" # Remove symbol files. Remove-Item "${buildFolder}\*.pdb" -Force } diff --git a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 index f96263ea6e8..e8d331cc90b 100644 --- a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 @@ -52,7 +52,7 @@ function BuildPackages { Start-PSBootstrap -Package -NoSudo - $buildParams = @{ Configuration = 'Release'; PSModuleRestore = $true; Restore = $true } + $buildParams = @{ Configuration = 'Release'; PSModuleRestore = $true; Restore = $true; ExperimentalFeatureJsonFilePath = "$location\ExperimentalFeatures.json"} if ($FxDependent.IsPresent) { $projectAssetsZipName = 'linuxFxDependantProjectAssetssymbols.zip' @@ -96,12 +96,12 @@ function BuildPackages { if ($TarArm) { ## Build 'linux-arm' and create 'tar.gz' package for it. ## Note that 'linux-arm' can only be built on Ubuntu environment. - Start-PSBuild -Configuration Release -Restore -Runtime linux-arm -PSModuleRestore @releaseTagParam + Start-PSBuild -Configuration Release -Restore -Runtime linux-arm -PSModuleRestore @releaseTagParam -ExperimentalFeatureJsonFilePath "$location\ExperimentalFeatures.json" Start-PSPackage -Type tar-arm @releaseTagParam -LTS:$LTS } if ($TarArm64) { - Start-PSBuild -Configuration Release -Restore -Runtime linux-arm64 -PSModuleRestore @releaseTagParam + Start-PSBuild -Configuration Release -Restore -Runtime linux-arm64 -PSModuleRestore @releaseTagParam --ExperimentalFeatureJsonFilePath "$location\ExperimentalFeatures.json" Start-PSPackage -Type tar-arm64 @releaseTagParam -LTS:$LTS } } finally { diff --git a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 index ae0bc4f2b10..a66b48f7225 100644 --- a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 @@ -98,6 +98,7 @@ try Write-Verbose "Starting powershell build for RID: $Runtime and ReleaseTag: $ReleaseTag ..." -Verbose $buildParams = @{ ForMinimalSize = $ForMinimalSize + ExperimentalFeatureJsonFilePath = "$location\ExperimentalFeatures.json" } if($Symbols) diff --git a/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 b/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 index acedbdd3388..557814f76fa 100644 --- a/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 +++ b/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 @@ -106,13 +106,13 @@ try { if ($Build) { if ($Symbols) { - Start-PSBuild -Clean -Configuration 'Release' -NoPSModuleRestore @releaseTagParam -Runtime $Runtime + Start-PSBuild -Clean -Configuration 'Release' -NoPSModuleRestore @releaseTagParam -Runtime $Runtime -ExperimentalFeatureJsonFilePath "$repoRoot/ExperimentalFeatures.json" $pspackageParams['Type']='zip' $pspackageParams['IncludeSymbols']=$Symbols.IsPresent Write-Verbose "Starting powershell packaging(zip)..." -Verbose Start-PSPackage @pspackageParams @releaseTagParam } else { - Start-PSBuild -Configuration 'Release' -PSModuleRestore @releaseTagParam -Runtime $Runtime + Start-PSBuild -Configuration 'Release' -PSModuleRestore @releaseTagParam -Runtime $Runtime -ExperimentalFeatureJsonFilePath "$repoRoot/ExperimentalFeatures.json" Start-PSPackage @pspackageParams @releaseTagParam switch ($ExtraPackage) { "tar" { Start-PSPackage -Type tar @pspackageParams @releaseTagParam } From e0111f98f3b45eca80034bb6c8e09a920587247d Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 31 Jan 2022 17:45:17 -0800 Subject: [PATCH 03/10] Fix path to json file --- tools/packaging/packaging.psm1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index a83c6906fcc..ff48a30b918 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -4368,12 +4368,12 @@ function Invoke-AzDevOpsLinuxPackageBuild { ## Build 'linux-arm' and create 'tar.gz' package for it. ## Note that 'linux-arm' can only be built on Ubuntu environment. $buildFolder = "${env:SYSTEM_ARTIFACTSDIRECTORY}/${arm32LinuxBuildFolder}" - Start-PSBuild -Configuration Release -Restore -Runtime linux-arm -PSModuleRestore @releaseTagParam -Output $buildFolder -PSOptionsPath "${buildFolder}-meta/psoptions.json" -ExperimentalFeatureJsonFilePath "$PSScriptRoot\..\ExperimentalFeatures.json" + Start-PSBuild -Configuration Release -Restore -Runtime linux-arm -PSModuleRestore @releaseTagParam -Output $buildFolder -PSOptionsPath "${buildFolder}-meta/psoptions.json" -ExperimentalFeatureJsonFilePath (Resolve-Path "$PSScriptRoot\..\..\ExperimentalFeatures.json") # Remove symbol files. Remove-Item "${buildFolder}\*.pdb" -Force $buildFolder = "${env:SYSTEM_ARTIFACTSDIRECTORY}/${arm64LinuxBuildFolder}" - Start-PSBuild -Configuration Release -Restore -Runtime linux-arm64 -PSModuleRestore @releaseTagParam -Output $buildFolder -PSOptionsPath "${buildFolder}-meta/psoptions.json" -ExperimentalFeatureJsonFilePath "$PSScriptRoot\..\ExperimentalFeatures.json" + Start-PSBuild -Configuration Release -Restore -Runtime linux-arm64 -PSModuleRestore @releaseTagParam -Output $buildFolder -PSOptionsPath "${buildFolder}-meta/psoptions.json" -ExperimentalFeatureJsonFilePath (Resolve-Path "$PSScriptRoot\..\..\ExperimentalFeatures.json") # Remove symbol files. Remove-Item "${buildFolder}\*.pdb" -Force } From ddea380b0ebd541fd0a83b5514c2a909cff506e1 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 31 Jan 2022 21:38:46 -0800 Subject: [PATCH 04/10] Add conditions for preview and RC --- build.psm1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.psm1 b/build.psm1 index 6a4c9baf3cb..52d15db8a98 100644 --- a/build.psm1 +++ b/build.psm1 @@ -625,7 +625,11 @@ Fix steps: "WindowsPowerShellCompatibilityModuleDenyList" = @("PSScheduledJob","BestPractices","UpdateServices") } } - if ($ExperimentalFeatureJsonFilePath) { + if (-not $SkipExperimentalFeatureGeneration -and + (Test-IsPreview $psVersion) -and + -not (Test-IsReleaseCandidate $psVersion) -and + $ExperimentalFeatureJsonFilePath) { + if (-not (Test-Path $ExperimentalFeatureJsonFilePath)) { throw "ExperimentalFeatureJsonFilePath: $ExperimentalFeatureJsonFilePath does not exist" } From bafb88bc25b0f78c54331fd95ae5eeb15d91192b Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 31 Jan 2022 23:00:43 -0800 Subject: [PATCH 05/10] Add latest experimental feature --- ExperimentalFeatures.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ExperimentalFeatures.json b/ExperimentalFeatures.json index 69f037f0d8a..6a0adc30d10 100644 --- a/ExperimentalFeatures.json +++ b/ExperimentalFeatures.json @@ -7,5 +7,6 @@ "PSNativeCommandErrorActionPreference", "PSNativePSPathResolution", "PSRemotingSSHTransportErrorHandling", - "PSSubsystemPluginModel" + "PSSubsystemPluginModel", + "PSAMSIMethodInvocationLogging" ] From 241e1787e57edcd6ffe2744a0bd755196f62e2cf Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Tue, 1 Feb 2022 17:40:49 -0800 Subject: [PATCH 06/10] Remove else block --- build.psm1 | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/build.psm1 b/build.psm1 index 52d15db8a98..48651a4232b 100644 --- a/build.psm1 +++ b/build.psm1 @@ -638,36 +638,7 @@ Fix steps: $config += @{ ExperimentalFeatures = ([string[]] ($json | ConvertFrom-Json)) } } else { - # When building preview, we want the configuration to enable all experiemental features by default - # ARM is cross compiled, so we can't run pwsh to enumerate Experimental Features - if (-not $SkipExperimentalFeatureGeneration -and - (Test-IsPreview $psVersion) -and - -not (Test-IsReleaseCandidate $psVersion) -and - -not $Runtime.Contains("arm") -and - -not ($Runtime -like 'fxdependent*')) { - - $json = & $publishPath\pwsh -noprofile -command { - # Special case for DSC code in PS; - # this experimental feature requires new DSC module that is not inbox, - # so we don't want default DSC use case be broken - [System.Collections.ArrayList] $expFeatures = Get-ExperimentalFeature | Where-Object Name -NE PS7DscSupport | ForEach-Object -MemberName Name - - $expFeatures | Out-String | Write-Verbose -Verbose - - # Make sure ExperimentalFeatures from modules in PSHome are added - # https://github.com/PowerShell/PowerShell/issues/10550 - $ExperimentalFeaturesFromGalleryModulesInPSHome = @() - $ExperimentalFeaturesFromGalleryModulesInPSHome | ForEach-Object { - if (!$expFeatures.Contains($_)) { - $null = $expFeatures.Add($_) - } - } - - ConvertTo-Json $expFeatures - } - - $config += @{ ExperimentalFeatures = ([string[]] ($json | ConvertFrom-Json)) } - } + Write-Warning -Message "Experimental features are not enabled in powershell.config.json file" } if ($config.Count -gt 0) { From 6a226ffb5de55dd380a7de6e438fbff3c02df099 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 4 Feb 2022 12:19:49 -0800 Subject: [PATCH 07/10] Always get experimental feature list from json file --- ExperimentalFeatures.json | 12 ---------- build.psm1 | 23 +++++++++++-------- tools/UpdateDotnetRuntime.ps1 | 2 +- tools/ci.psm1 | 12 +++++----- tools/packaging/packaging.psm1 | 6 ++--- .../GenericLinuxFiles/PowerShellPackage.ps1 | 6 ++--- .../PowerShellPackage.ps1 | 1 - .../macOS/PowerShellPackageVsts.ps1 | 4 ++-- 8 files changed, 28 insertions(+), 38 deletions(-) delete mode 100644 ExperimentalFeatures.json diff --git a/ExperimentalFeatures.json b/ExperimentalFeatures.json deleted file mode 100644 index 6a0adc30d10..00000000000 --- a/ExperimentalFeatures.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - "PSAnsiRenderingFileInfo", - "PSCleanBlock", - "PSCommandNotFoundSuggestion", - "PSLoadAssemblyFromNativeCode", - "PSNativeCommandArgumentPassing", - "PSNativeCommandErrorActionPreference", - "PSNativePSPathResolution", - "PSRemotingSSHTransportErrorHandling", - "PSSubsystemPluginModel", - "PSAMSIMethodInvocationLogging" -] diff --git a/build.psm1 b/build.psm1 index 48651a4232b..18862a08c1e 100644 --- a/build.psm1 +++ b/build.psm1 @@ -324,8 +324,7 @@ function Start-PSBuild { [switch]$Detailed, [switch]$InteractiveAuth, [switch]$SkipRoslynAnalyzers, - [string]$PSOptionsPath, - [string]$ExperimentalFeatureJsonFilePath + [string]$PSOptionsPath ) if ($ReleaseTag -and $ReleaseTag -notmatch "^v\d+\.\d+\.\d+(-(preview|rc)(\.\d{1,2})?)?$") { @@ -620,15 +619,20 @@ Fix steps: # publish powershell.config.json $config = @{} - if ($environment.IsWindows) { - $config = @{ "Microsoft.PowerShell:ExecutionPolicy" = "RemoteSigned"; - "WindowsPowerShellCompatibilityModuleDenyList" = @("PSScheduledJob","BestPractices","UpdateServices") } - } if (-not $SkipExperimentalFeatureGeneration -and (Test-IsPreview $psVersion) -and - -not (Test-IsReleaseCandidate $psVersion) -and - $ExperimentalFeatureJsonFilePath) { + -not (Test-IsReleaseCandidate $psVersion) + ) { + + if ($Options.Runtime -like "*win*") { + $config = @{ "Microsoft.PowerShell:ExecutionPolicy" = "RemoteSigned"; + "WindowsPowerShellCompatibilityModuleDenyList" = @("PSScheduledJob", "BestPractices", "UpdateServices") + } + $ExperimentalFeatureJsonFilePath = "$PSScriptRoot/experimental-feature-windows.json" + } else { + $ExperimentalFeatureJsonFilePath = "$PSScriptRoot/experimental-feature-linux.json" + } if (-not (Test-Path $ExperimentalFeatureJsonFilePath)) { throw "ExperimentalFeatureJsonFilePath: $ExperimentalFeatureJsonFilePath does not exist" @@ -636,8 +640,7 @@ Fix steps: $json = Get-Content -Raw $ExperimentalFeatureJsonFilePath $config += @{ ExperimentalFeatures = ([string[]] ($json | ConvertFrom-Json)) } - } - else { + } else { Write-Warning -Message "Experimental features are not enabled in powershell.config.json file" } diff --git a/tools/UpdateDotnetRuntime.ps1 b/tools/UpdateDotnetRuntime.ps1 index a6a4610e6f5..6747368a4c6 100644 --- a/tools/UpdateDotnetRuntime.ps1 +++ b/tools/UpdateDotnetRuntime.ps1 @@ -342,7 +342,7 @@ if ($dotnetUpdate.ShouldUpdate) { Import-Module "$PSScriptRoot/../build.psm1" -Force Import-Module "$PSScriptRoot/packaging" -Force Start-PSBootstrap -Package - Start-PSBuild -Clean -Configuration Release -CrossGen -InteractiveAuth:$InteractiveAuth -ExperimentalFeatureJsonFilePath "$PSScriptRoot/../ExperimentalFeatures.json" + Start-PSBuild -Clean -Configuration Release -CrossGen -InteractiveAuth:$InteractiveAuth $publishPath = Split-Path (Get-PSOutput) Remove-Item -Path "$publishPath\*.pdb" diff --git a/tools/ci.psm1 b/tools/ci.psm1 index 7431a41c2ff..f4ed3c78945 100644 --- a/tools/ci.psm1 +++ b/tools/ci.psm1 @@ -96,10 +96,10 @@ function Invoke-CIBuild if(Test-DailyBuild) { - Start-PSBuild -Configuration 'CodeCoverage' -PSModuleRestore -CI -ReleaseTag $releaseTag -ExperimentalFeatureJsonFilePath "$PSScriptRoot\..\ExperimentalFeatures.json" + Start-PSBuild -Configuration 'CodeCoverage' -PSModuleRestore -CI -ReleaseTag $releaseTag } - Start-PSBuild -PSModuleRestore -Configuration 'Release' -CI -ReleaseTag $releaseTag -ExperimentalFeatureJsonFilePath "$PSScriptRoot\..\ExperimentalFeatures.json" + Start-PSBuild -PSModuleRestore -Configuration 'Release' -CI -ReleaseTag $releaseTag Save-PSOptions $options = (Get-PSOptions) @@ -347,7 +347,7 @@ function New-CodeCoverageAndTestPackage { Start-PSBootstrap -Verbose - Start-PSBuild -Configuration 'CodeCoverage' -Clean -ExperimentalFeatureJsonFilePath "$PSScriptRoot\..\ExperimentalFeatures.json" + Start-PSBuild -Configuration 'CodeCoverage' -Clean $codeCoverageOutput = Split-Path -Parent (Get-PSOutput) $codeCoverageArtifacts = Compress-CoverageArtifacts -CodeCoverageOutput $codeCoverageOutput @@ -471,7 +471,7 @@ function Invoke-CIFinish $prereleaseIteration = (get-date).Day $preReleaseVersion = "$previewPrefix-$previewLabel.$prereleaseIteration" # Build clean before backing to remove files from testing - Start-PSBuild -PSModuleRestore -Configuration 'Release' -ReleaseTag $preReleaseVersion -Clean -Runtime $Runtime -output $buildFolder -PSOptionsPath "${buildFolder}/psoptions.json" -ExperimentalFeatureJsonFilePath "$PSScriptRoot\..\ExperimentalFeatures.json" + Start-PSBuild -PSModuleRestore -Configuration 'Release' -ReleaseTag $preReleaseVersion -Clean -Runtime $Runtime -output $buildFolder -PSOptionsPath "${buildFolder}/psoptions.json" $options = Get-PSOptions # Remove symbol files. $filter = Join-Path -Path (Split-Path $options.Output) -ChildPath '*.pdb' @@ -482,7 +482,7 @@ function Invoke-CIFinish $releaseTagParts = $releaseTag.split('.') $preReleaseVersion = $releaseTagParts[0]+ ".9.9" Write-Verbose "newPSReleaseTag: $preReleaseVersion" -Verbose - Start-PSBuild -PSModuleRestore -Configuration 'Release' -ReleaseTag $preReleaseVersion -Clean -Runtime $Runtime -output $buildFolder -PSOptionsPath "${buildFolder}/psoptions.json" -ExperimentalFeatureJsonFilePath "$PSScriptRoot\..\ExperimentalFeatures.json" + Start-PSBuild -PSModuleRestore -Configuration 'Release' -ReleaseTag $preReleaseVersion -Clean -Runtime $Runtime -output $buildFolder -PSOptionsPath "${buildFolder}/psoptions.json" $options = Get-PSOptions # Remove symbol files. $filter = Join-Path -Path (Split-Path $options.Output) -ChildPath '*.pdb' @@ -760,7 +760,7 @@ function New-LinuxPackage if ($IsLinux) { # Create and package Raspbian .tgz - Start-PSBuild -PSModuleRestore -Clean -Runtime linux-arm -Configuration 'Release' -ExperimentalFeatureJsonFilePath "$PSScriptRoot\..\ExperimentalFeatures.json" + Start-PSBuild -PSModuleRestore -Clean -Runtime linux-arm -Configuration 'Release' $armPackage = Start-PSPackage @packageParams -Type tar-arm -SkipReleaseChecks Copy-Item $armPackage -Destination "${env:BUILD_ARTIFACTSTAGINGDIRECTORY}" -Force } diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index ff48a30b918..db69625b048 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -4328,7 +4328,7 @@ function Invoke-AzDevOpsLinuxPackageBuild { $releaseTagParam = @{ 'ReleaseTag' = $ReleaseTag } - $buildParams = @{ Configuration = 'Release'; PSModuleRestore = $true; Restore = $true; ExperimentalFeatureJsonFilePath = "$PSScriptRoot/../../ExperimentalFeatures.json" } + $buildParams = @{ Configuration = 'Release'; PSModuleRestore = $true; Restore = $true} switch ($BuildType) { 'fxdependent' { @@ -4368,12 +4368,12 @@ function Invoke-AzDevOpsLinuxPackageBuild { ## Build 'linux-arm' and create 'tar.gz' package for it. ## Note that 'linux-arm' can only be built on Ubuntu environment. $buildFolder = "${env:SYSTEM_ARTIFACTSDIRECTORY}/${arm32LinuxBuildFolder}" - Start-PSBuild -Configuration Release -Restore -Runtime linux-arm -PSModuleRestore @releaseTagParam -Output $buildFolder -PSOptionsPath "${buildFolder}-meta/psoptions.json" -ExperimentalFeatureJsonFilePath (Resolve-Path "$PSScriptRoot\..\..\ExperimentalFeatures.json") + Start-PSBuild -Configuration Release -Restore -Runtime linux-arm -PSModuleRestore @releaseTagParam -Output $buildFolder -PSOptionsPath "${buildFolder}-meta/psoptions.json" # Remove symbol files. Remove-Item "${buildFolder}\*.pdb" -Force $buildFolder = "${env:SYSTEM_ARTIFACTSDIRECTORY}/${arm64LinuxBuildFolder}" - Start-PSBuild -Configuration Release -Restore -Runtime linux-arm64 -PSModuleRestore @releaseTagParam -Output $buildFolder -PSOptionsPath "${buildFolder}-meta/psoptions.json" -ExperimentalFeatureJsonFilePath (Resolve-Path "$PSScriptRoot\..\..\ExperimentalFeatures.json") + Start-PSBuild -Configuration Release -Restore -Runtime linux-arm64 -PSModuleRestore @releaseTagParam -Output $buildFolder -PSOptionsPath "${buildFolder}-meta/psoptions.json" # Remove symbol files. Remove-Item "${buildFolder}\*.pdb" -Force } diff --git a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 index e8d331cc90b..0b7924b3a22 100644 --- a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 @@ -52,7 +52,7 @@ function BuildPackages { Start-PSBootstrap -Package -NoSudo - $buildParams = @{ Configuration = 'Release'; PSModuleRestore = $true; Restore = $true; ExperimentalFeatureJsonFilePath = "$location\ExperimentalFeatures.json"} + $buildParams = @{ Configuration = 'Release'; PSModuleRestore = $true; Restore = $true} if ($FxDependent.IsPresent) { $projectAssetsZipName = 'linuxFxDependantProjectAssetssymbols.zip' @@ -96,12 +96,12 @@ function BuildPackages { if ($TarArm) { ## Build 'linux-arm' and create 'tar.gz' package for it. ## Note that 'linux-arm' can only be built on Ubuntu environment. - Start-PSBuild -Configuration Release -Restore -Runtime linux-arm -PSModuleRestore @releaseTagParam -ExperimentalFeatureJsonFilePath "$location\ExperimentalFeatures.json" + Start-PSBuild -Configuration Release -Restore -Runtime linux-arm -PSModuleRestore @releaseTagParam Start-PSPackage -Type tar-arm @releaseTagParam -LTS:$LTS } if ($TarArm64) { - Start-PSBuild -Configuration Release -Restore -Runtime linux-arm64 -PSModuleRestore @releaseTagParam --ExperimentalFeatureJsonFilePath "$location\ExperimentalFeatures.json" + Start-PSBuild -Configuration Release -Restore -Runtime linux-arm64 -PSModuleRestore @releaseTagParam Start-PSPackage -Type tar-arm64 @releaseTagParam -LTS:$LTS } } finally { diff --git a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 index a66b48f7225..ae0bc4f2b10 100644 --- a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 @@ -98,7 +98,6 @@ try Write-Verbose "Starting powershell build for RID: $Runtime and ReleaseTag: $ReleaseTag ..." -Verbose $buildParams = @{ ForMinimalSize = $ForMinimalSize - ExperimentalFeatureJsonFilePath = "$location\ExperimentalFeatures.json" } if($Symbols) diff --git a/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 b/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 index 557814f76fa..acedbdd3388 100644 --- a/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 +++ b/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 @@ -106,13 +106,13 @@ try { if ($Build) { if ($Symbols) { - Start-PSBuild -Clean -Configuration 'Release' -NoPSModuleRestore @releaseTagParam -Runtime $Runtime -ExperimentalFeatureJsonFilePath "$repoRoot/ExperimentalFeatures.json" + Start-PSBuild -Clean -Configuration 'Release' -NoPSModuleRestore @releaseTagParam -Runtime $Runtime $pspackageParams['Type']='zip' $pspackageParams['IncludeSymbols']=$Symbols.IsPresent Write-Verbose "Starting powershell packaging(zip)..." -Verbose Start-PSPackage @pspackageParams @releaseTagParam } else { - Start-PSBuild -Configuration 'Release' -PSModuleRestore @releaseTagParam -Runtime $Runtime -ExperimentalFeatureJsonFilePath "$repoRoot/ExperimentalFeatures.json" + Start-PSBuild -Configuration 'Release' -PSModuleRestore @releaseTagParam -Runtime $Runtime Start-PSPackage @pspackageParams @releaseTagParam switch ($ExtraPackage) { "tar" { Start-PSPackage -Type tar @pspackageParams @releaseTagParam } From 4933d403d4d31aa059c67bc70aad2f20982708cf Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 4 Feb 2022 12:32:38 -0800 Subject: [PATCH 08/10] Remove formatting change --- tools/packaging/packaging.psm1 | 2 +- .../releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index db69625b048..929d7868a44 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -4328,7 +4328,7 @@ function Invoke-AzDevOpsLinuxPackageBuild { $releaseTagParam = @{ 'ReleaseTag' = $ReleaseTag } - $buildParams = @{ Configuration = 'Release'; PSModuleRestore = $true; Restore = $true} + $buildParams = @{ Configuration = 'Release'; PSModuleRestore = $true; Restore = $true } switch ($BuildType) { 'fxdependent' { diff --git a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 index 0b7924b3a22..f96263ea6e8 100644 --- a/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 +++ b/tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 @@ -52,7 +52,7 @@ function BuildPackages { Start-PSBootstrap -Package -NoSudo - $buildParams = @{ Configuration = 'Release'; PSModuleRestore = $true; Restore = $true} + $buildParams = @{ Configuration = 'Release'; PSModuleRestore = $true; Restore = $true } if ($FxDependent.IsPresent) { $projectAssetsZipName = 'linuxFxDependantProjectAssetssymbols.zip' From 689b7e68390719dcddbb0a60286d22ffdb470aaa Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 4 Feb 2022 12:41:12 -0800 Subject: [PATCH 09/10] Update build.psm1 Co-authored-by: Travis Plunk --- build.psm1 | 1 + 1 file changed, 1 insertion(+) diff --git a/build.psm1 b/build.psm1 index 18862a08c1e..75a184407e9 100644 --- a/build.psm1 +++ b/build.psm1 @@ -626,6 +626,7 @@ Fix steps: ) { if ($Options.Runtime -like "*win*") { + # Execution Policy is only supported on Windows $config = @{ "Microsoft.PowerShell:ExecutionPolicy" = "RemoteSigned"; "WindowsPowerShellCompatibilityModuleDenyList" = @("PSScheduledJob", "BestPractices", "UpdateServices") } From 9349d0358fef2fa1b8659032554ebecb524fc3e8 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 4 Feb 2022 14:25:12 -0800 Subject: [PATCH 10/10] Make sure windows has config file when there are not experimental features --- build.psm1 | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/build.psm1 b/build.psm1 index 75a184407e9..bd425ff9bf4 100644 --- a/build.psm1 +++ b/build.psm1 @@ -620,19 +620,22 @@ Fix steps: # publish powershell.config.json $config = @{} + if ($Options.Runtime -like "*win*") { + # Execution Policy is only supported on Windows + $config = @{ "Microsoft.PowerShell:ExecutionPolicy" = "RemoteSigned"; + "WindowsPowerShellCompatibilityModuleDenyList" = @("PSScheduledJob", "BestPractices", "UpdateServices") + } + } + if (-not $SkipExperimentalFeatureGeneration -and (Test-IsPreview $psVersion) -and -not (Test-IsReleaseCandidate $psVersion) ) { - if ($Options.Runtime -like "*win*") { - # Execution Policy is only supported on Windows - $config = @{ "Microsoft.PowerShell:ExecutionPolicy" = "RemoteSigned"; - "WindowsPowerShellCompatibilityModuleDenyList" = @("PSScheduledJob", "BestPractices", "UpdateServices") - } - $ExperimentalFeatureJsonFilePath = "$PSScriptRoot/experimental-feature-windows.json" + $ExperimentalFeatureJsonFilePath = if ($Options.Runtime -like "*win*") { + "$PSScriptRoot/experimental-feature-windows.json" } else { - $ExperimentalFeatureJsonFilePath = "$PSScriptRoot/experimental-feature-linux.json" + "$PSScriptRoot/experimental-feature-linux.json" } if (-not (Test-Path $ExperimentalFeatureJsonFilePath)) {