mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Allow cross compiling windows (#19119)
* Allow cross compiling windows * fix exp feature generation * make sure all platforms have OSArchitecture
This commit is contained in:
+44
-1
@@ -159,6 +159,7 @@ function Get-EnvironmentInformation
|
||||
}
|
||||
|
||||
if ($environment.IsLinux) {
|
||||
$environment += @{ 'OSArchitecture' = [System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture }
|
||||
$LinuxInfo = Get-Content /etc/os-release -Raw | ConvertFrom-StringData
|
||||
$lsb_release = Get-Command lsb_release -Type Application -ErrorAction Ignore | Select-Object -First 1
|
||||
if ($lsb_release) {
|
||||
@@ -455,6 +456,9 @@ Fix steps:
|
||||
|
||||
if ($Options.Runtime -like 'win*' -or ($Options.Runtime -like 'fxdependent*' -and $environment.IsWindows)) {
|
||||
$Arguments += "/property:IsWindows=true"
|
||||
if(!$environment.IsWindows) {
|
||||
$Arguments += "/property:EnableWindowsTargeting=true"
|
||||
}
|
||||
}
|
||||
else {
|
||||
$Arguments += "/property:IsWindows=false"
|
||||
@@ -648,7 +652,7 @@ Fix steps:
|
||||
(Test-IsPreview $psVersion) -and
|
||||
-not (Test-IsReleaseCandidate $psVersion)
|
||||
) {
|
||||
if (-not $env:PS_RELEASE_BUILD -and -not $Runtime.Contains("arm") -and -not ($Runtime -like 'fxdependent*')) {
|
||||
if ((Test-ShouldGenerateExperimentalFeatures -Runtime $Options.Runtime)) {
|
||||
Write-Verbose "Build experimental feature list by running 'Get-ExperimentalFeature'" -Verbose
|
||||
$json = & $publishPath\pwsh -noprofile -command {
|
||||
$expFeatures = Get-ExperimentalFeature | ForEach-Object -MemberName Name
|
||||
@@ -697,6 +701,45 @@ Fix steps:
|
||||
}
|
||||
}
|
||||
|
||||
function Test-ShouldGenerateExperimentalFeatures
|
||||
{
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
$Runtime
|
||||
)
|
||||
|
||||
if ($env:PS_RELEASE_BUILD) {
|
||||
return $false
|
||||
}
|
||||
|
||||
if ($Runtime -like 'fxdependent*') {
|
||||
return $false
|
||||
}
|
||||
|
||||
$runtimePattern = 'unknown-'
|
||||
if ($environment.IsWindows) {
|
||||
$runtimePattern = '^win.*-'
|
||||
}
|
||||
|
||||
if ($environment.IsMacOS) {
|
||||
$runtimePattern = '^osx.*-'
|
||||
}
|
||||
|
||||
if ($environment.IsLinux) {
|
||||
$runtimePattern = '^linux.*-'
|
||||
}
|
||||
|
||||
$runtimePattern += $environment.OSArchitecture.ToString()
|
||||
Write-Verbose "runtime pattern check: $Runtime -match $runtimePattern" -Verbose
|
||||
if ($Runtime -match $runtimePattern) {
|
||||
Write-Verbose "Generating experimental feature list" -Verbose
|
||||
return $true
|
||||
}
|
||||
|
||||
Write-Verbose "Skipping generating experimental feature list" -Verbose
|
||||
return $false
|
||||
}
|
||||
|
||||
function Restore-PSPackage
|
||||
{
|
||||
[CmdletBinding()]
|
||||
|
||||
Reference in New Issue
Block a user