Merge ethie/shared-product-builders with the CI dependency cache and native Windows setup work. Preserve UTF-8 diagnostics in the shared Python environment runner. Pass a persistent cache through isolated native staging and PM-runtime construction. Reuse one Windows prerequisite installer from source setup, native adapters, and CI, preserving Rust homes across HOME isolation. Verified 85 targeted Python tests (5 host skips), 18 JavaScript tests, workflow validation, and scoped lint/typecheck. On native Windows ARM64, five prerequisite contracts passed and the actual shared provider reused OpenSSL, compiled its header with MSVC, and retained Rust under isolated HOME. Full signed distribution builds and live Actions cache transfer remain CI verification.
45 lines
2.0 KiB
PowerShell
45 lines
2.0 KiB
PowerShell
# Build-only prerequisites; setup-hermes.ps1 uses the same installer functions.
|
|
param(
|
|
[Parameter(Mandatory = $true)][string]$StateRoot,
|
|
[string]$OpenSSLRoot,
|
|
[string]$EnvironmentFile,
|
|
[string]$GithubEnv,
|
|
[string]$GithubPath
|
|
)
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$before = @{}
|
|
Get-ChildItem Env: | ForEach-Object { $before[$_.Name] = $_.Value }
|
|
. (Join-Path $PSScriptRoot '..\windows-build-deps.ps1')
|
|
Initialize-HermesArm64BuildTools -StateRoot $StateRoot -OpenSSLRoot $OpenSSLRoot
|
|
|
|
$after = @{}
|
|
Get-ChildItem Env: | ForEach-Object { $after[$_.Name] = $_.Value }
|
|
$utf8 = New-Object System.Text.UTF8Encoding($false)
|
|
if ($EnvironmentFile) {
|
|
# The caller owns this temporary file: it includes the inherited environment.
|
|
[IO.File]::WriteAllText($EnvironmentFile, ($after | ConvertTo-Json -Compress), $utf8)
|
|
}
|
|
if ($GithubEnv) {
|
|
foreach ($name in ($after.Keys | Sort-Object)) {
|
|
# GitHub rejects writes to its own variables (and NODE_OPTIONS).
|
|
if ($name -match '^(GITHUB_|RUNNER_)' -or $name -eq 'NODE_OPTIONS') { continue }
|
|
if ($name -eq 'PATH' -and $GithubPath) { continue }
|
|
# Rust homes must stay explicit when a later child isolates HOME.
|
|
if ($name -notin @('CARGO_HOME', 'RUSTUP_HOME') -and
|
|
$before.ContainsKey($name) -and $before[$name] -ceq $after[$name]) { continue }
|
|
$delimiter = 'hermes_' + [Guid]::NewGuid().ToString('N')
|
|
[IO.File]::AppendAllText($GithubEnv, "$name<<$delimiter`n$($after[$name])`n$delimiter`n", $utf8)
|
|
}
|
|
}
|
|
if ($GithubPath) {
|
|
# The runner prepends each line. Reverse only new entries so their compiler
|
|
# search order survives, without replacing the caller's inherited PATH.
|
|
$inherited = @($before['PATH'] -split ';')
|
|
$added = @($after['PATH'] -split ';' | Where-Object { $_ -and $_ -notin $inherited } | Select-Object -Unique)
|
|
[array]::Reverse($added)
|
|
foreach ($entry in $added) {
|
|
[IO.File]::AppendAllText($GithubPath, "$entry`n", $utf8)
|
|
}
|
|
}
|