From 648eec4d2c4207d5a6e3d1aadfeee60f0c638ee5 Mon Sep 17 00:00:00 2001 From: Steve Otteson Date: Thu, 6 May 2021 15:28:56 -0700 Subject: [PATCH] Modify build for partition script to build crossarch by default, which then builds the architectures --- .../GenerateMetadataSourceForPartition.ps1 | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/scripts/GenerateMetadataSourceForPartition.ps1 b/scripts/GenerateMetadataSourceForPartition.ps1 index 6ebc5ed3..90a577c3 100644 --- a/scripts/GenerateMetadataSourceForPartition.ps1 +++ b/scripts/GenerateMetadataSourceForPartition.ps1 @@ -10,14 +10,46 @@ param [string] $partitionName, - [ValidateSet("x64", "x86", "arm64")] + [ValidateSet("crossarch", "x64", "x86", "arm64")] [string] - $arch = "x64", + $arch = "crossarch", [string] $indent = "" ) +if ($arch -eq "crossarch") +{ + Write-Output "Scraping $($indent)$partitionName for all architectures..." + + $throttleCount = [System.Environment]::ProcessorCount / 2 + if ($throttleCount -lt 2) + { + $throttleCount = 2 + } + + $errObj = new-object psobject + Add-Member -InputObject $errObj -MemberType NoteProperty -Name ErrorCode -Value 0 + + "x64", "x86", "arm64" | ForEach-Object -Parallel { + $out = & $using:PSCommandPath -artifactsDir $using:artifactsDir -version $using:version -partitionName $using:partitionName -arch $_ -indent "`n " + Write-Output "$out" + + if ($LastExitCode -lt 0) + { + Write-Error "Partition $_ failed for $_." + $localObj.ErrorCode = $LastExitCode + } + } -ThrottleLimit $throttleCount + + if ($errObj.ErrorCode -ne 0) + { + exit $errObj.ErrorCode + } + + exit 0 +} + if (($arch -eq "x64") -or ($arch -eq "arm64")) { $bitness = 64 @@ -84,7 +116,7 @@ $generatedSourceDir = "$rootDir\generation\emitter\generated\$arch" [hashtable]$textToReplaceTable = @{ "" = $includePath; "" = $rootDir; "" = $partitionName; "" = $partitionGenerateDir; "" = $generatedSourceDir} Replace-Text $fixedSettingsRsp $textToReplaceTable -Write-Output "$($indent)$partitionName..." +Write-Output "$($indent)$partitionName for $arch..." Write-Output "$($indent)$toolsDir\ClangSharpPInvokeGenerator.exe @$baseSettingsRsp @$baseSettingsBitnessRsp @$baseSettingsArchRsp @$withSetLastErrorRsp @$supportedOSRsp @$fixedSettingsRsp @$baseRemapRsp @$autoTypesRemapRsp @$functionPointerFixupsRsp @$libMappingOutputFileName > $generatorOutput" & $toolsDir\ClangSharpPInvokeGenerator.exe "@$baseSettingsRsp" "@$baseSettingsBitnessRsp" "@$baseSettingsArchRsp" "@$withSetLastErrorRsp" "@$supportedOSRsp" "@$fixedSettingsRsp" "@$baseRemapRsp" "@$autoTypesRemapRsp" "@$functionPointerFixupsRsp" "@$libMappingOutputFileName" > $generatorOutput