mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Avoid depending on the pre-generated experimental feature list in private and CI builds (#18484)
This commit is contained in:
+23
-14
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user