Add ability to cross compile (#9374)

`-CrossGen` won`t work, but this gives basic ability to build for another platform.
This also means you cannot really package for another platform.
This commit is contained in:
Travis Plunk
2019-04-16 14:14:29 -07:00
committed by GitHub
parent 73114ee36c
commit cee1e54e75
3 changed files with 34 additions and 18 deletions
+1 -1
View File
@@ -111,7 +111,7 @@
<PropertyGroup>
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
<IsWindows Condition="'$(OS)' == 'Windows_NT'">true</IsWindows>
<IsWindows Condition="'$(IsWindows)' =='true' or ( '$(IsWindows)' == '' and '$(OS)' == 'Windows_NT')">true</IsWindows>
</PropertyGroup>
<!-- Define non-windows, all configuration properties -->
+29 -15
View File
@@ -237,7 +237,8 @@ function Start-PSBuild {
[ValidatePattern("^v\d+\.\d+\.\d+(-\w+(\.\d+)?)?$")]
[ValidateNotNullOrEmpty()]
[string]$ReleaseTag
[string]$ReleaseTag,
[switch]$Detailed
)
if ($PsCmdlet.ParameterSetName -eq "Default" -and !$NoPSModuleRestore)
@@ -327,10 +328,22 @@ Fix steps:
$Arguments += "--output", (Split-Path $Options.Output)
}
if ($Options.Runtime -like 'win*' -or ($Options.Runtime -eq 'fxdependent' -and $Environment.IsWindows)) {
$Arguments += "/property:IsWindows=true"
}
else {
$Arguments += "/property:IsWindows=false"
}
$Arguments += "--configuration", $Options.Configuration
$Arguments += "--framework", $Options.Framework
if (-not $SMAOnly -and $Options.Runtime -ne 'fxdependent') {
if ($Detailed.IsPresent)
{
$Arguments += '--verbosity', 'd'
}
if (-not $SMAOnly -and $Options.Runtime -notlike 'fxdependent*') {
# libraries should not have runtime
$Arguments += "--runtime", $Options.Runtime
}
@@ -653,19 +666,6 @@ function New-PSOptions {
}
Write-Verbose "Using configuration '$Configuration'"
$PowerShellDir = if (!$Environment.IsWindows) {
"powershell-unix"
} else {
"powershell-win-core"
}
$Top = [IO.Path]::Combine($PSScriptRoot, "src", $PowerShellDir)
Write-Verbose "Top project directory is $Top"
if (-not $Framework) {
$Framework = "netcoreapp2.1"
Write-Verbose "Using framework '$Framework'"
}
if (-not $Runtime) {
if ($Environment.IsLinux) {
$Runtime = "linux-x64"
@@ -691,6 +691,20 @@ function New-PSOptions {
}
}
$PowerShellDir = if ($Runtime -like 'win*' -or ($Runtime -eq 'fxdependent' -and $Environment.IsWindows)) {
"powershell-win-core"
} else {
"powershell-unix"
}
$Top = [IO.Path]::Combine($PSScriptRoot, "src", $PowerShellDir)
Write-Verbose "Top project directory is $Top"
if (-not $Framework) {
$Framework = "netcoreapp2.1"
Write-Verbose "Using framework '$Framework'"
}
$Executable = if ($Runtime -eq 'fxdependent') {
"pwsh.dll"
} elseif ($Environment.IsLinux -or $Environment.IsMacOS) {
@@ -329,11 +329,13 @@ function ValidateSaveHelp
$compressedFile = GetFiles -fileType "*$extension" -path $path | ForEach-Object {Split-Path $_ -Leaf}
$expectedCompressedFile = $testCases[$moduleName].CompressedFiles
$expectedCompressedFile | Should -Be $compressedFile
$expectedCompressedFile | Should -Not -BeNullOrEmpty -Because "Test data (expectedCompressedFile) should never be null"
$compressedFile | Should -Be $expectedCompressedFile -Because "Save-Help for $module should download '$expectedCompressedFile'"
$helpInfoFile = GetFiles -fileType "*HelpInfo.xml" -path $path | ForEach-Object {Split-Path $_ -Leaf}
$expectedHelpInfoFile = $testCases[$moduleName].HelpInfoFiles
$expectedHelpInfoFile | Should -Be $helpInfoFile
$expectedHelpInfoFile | Should -Not -BeNullOrEmpty -Because "Test data (expectedHelpInfoFile) should never be null"
$helpInfoFile | Should -Be $expectedHelpInfoFile -Because "Save-Help for $module should download '$expectedHelpInfoFile'"
}
Describe "Validate Update-Help from the Web for one PowerShell Core module." -Tags @('CI', 'RequireAdminOnWindows', 'RequireSudoOnUnix') {