Avoid depending on the pre-generated experimental feature list in private and CI builds (#18484)

This commit is contained in:
Dongbo Wang
2022-11-09 17:26:53 -08:00
committed by GitHub
parent 21a7ab7cdd
commit 18093283ed
2 changed files with 25 additions and 14 deletions
+23 -14
View File
@@ -635,32 +635,41 @@ Fix steps:
}
# publish powershell.config.json
$config = @{}
$config = [ordered]@{}
if ($Options.Runtime -like "*win*") {
# Execution Policy is only supported on Windows
$config = @{ "Microsoft.PowerShell:ExecutionPolicy" = "RemoteSigned";
"WindowsPowerShellCompatibilityModuleDenyList" = @("PSScheduledJob", "BestPractices", "UpdateServices")
}
# Execution Policy and WinCompat feature are only supported on Windows.
$config.Add("Microsoft.PowerShell:ExecutionPolicy", "RemoteSigned")
$config.Add("WindowsPowerShellCompatibilityModuleDenyList", @("PSScheduledJob", "BestPractices", "UpdateServices"))
}
if (-not $SkipExperimentalFeatureGeneration -and
(Test-IsPreview $psVersion) -and
-not (Test-IsReleaseCandidate $psVersion)
) {
$ExperimentalFeatureJsonFilePath = if ($Options.Runtime -like "*win*") {
"$PSScriptRoot/experimental-feature-windows.json"
if (-not $env:PS_RELEASE_BUILD -and -not $Runtime.Contains("arm") -and -not ($Runtime -like 'fxdependent*')) {
Write-Verbose "Build experimental feature list by running 'Get-ExperimentalFeature'" -Verbose
$json = & $publishPath\pwsh -noprofile -command {
$expFeatures = Get-ExperimentalFeature | ForEach-Object -MemberName Name
ConvertTo-Json $expFeatures
}
} else {
"$PSScriptRoot/experimental-feature-linux.json"
Write-Verbose "Build experimental feature list by using the pre-generated JSON files" -Verbose
$ExperimentalFeatureJsonFilePath = if ($Options.Runtime -like "*win*") {
"$PSScriptRoot/experimental-feature-windows.json"
} else {
"$PSScriptRoot/experimental-feature-linux.json"
}
if (-not (Test-Path $ExperimentalFeatureJsonFilePath)) {
throw "ExperimentalFeatureJsonFilePath: $ExperimentalFeatureJsonFilePath does not exist"
}
$json = Get-Content -Raw $ExperimentalFeatureJsonFilePath
}
if (-not (Test-Path $ExperimentalFeatureJsonFilePath)) {
throw "ExperimentalFeatureJsonFilePath: $ExperimentalFeatureJsonFilePath does not exist"
}
$config.Add('ExperimentalFeatures', [string[]]($json | ConvertFrom-Json));
$json = Get-Content -Raw $ExperimentalFeatureJsonFilePath
$config += @{ ExperimentalFeatures = ([string[]] ($json | ConvertFrom-Json)) }
} else {
Write-Warning -Message "Experimental features are not enabled in powershell.config.json file"
}
@@ -28,6 +28,8 @@ resources:
ref: master
variables:
- name: PS_RELEASE_BUILD
value: 1
- name: DOTNET_CLI_TELEMETRY_OPTOUT
value: 1
- name: POWERSHELL_TELEMETRY_OPTOUT