Files
Stirling-PDF/scripts/build-jlink-runtime.ps1
T
Ludy87 ca48361d26 Improve desktop build config and Windows support
Rename CACHE to JLINK_REUSE_CACHE for clarity about JAR reuse. Fix desktop:dev:login task to properly pass SECURITY_ENABLELOGIN as env var. Improve Windows compatibility in verify-bundled-jre.mjs by using cmd.exe as Task launcher. Rename desktop_enable_login_flag() to desktop_login_enabled_from_env() for clarity. Add documentation for desktop dev modes and override options. Add comments explaining compression fallback and file permissions handling.
2026-07-06 09:19:15 +02:00

33 lines
990 B
PowerShell

param(
[Parameter(Mandatory = $true)]
[string]$Modules
)
$ErrorActionPreference = "Stop"
$Jlink = if ($env:JAVA_HOME) {
Join-Path $env:JAVA_HOME "bin/jlink.exe"
} else {
"jlink.exe"
}
$HelpText = & $Jlink --help 2>&1 | Out-String
# Older JDKs do not support the newer zip compressor selector, so fall back to
# the numeric compression level they do understand.
$Compress = if ($HelpText -match "zip-\[0-9\]") { "zip-6" } else { "2" }
& $Jlink `
--add-modules "$Modules,jdk.crypto.mscapi" `
--strip-debug `
--compress="$Compress" `
--no-header-files `
--no-man-pages `
--output runtime/jre
# Tauri's resource staging preserves source permissions, so the bundled runtime
# must be writable here or the next incremental build can fail on read-only JRE
# files copied into the target directory.
Get-ChildItem -Recurse runtime/jre -Force -File | ForEach-Object {
$_.Attributes = $_.Attributes -band (-bnot [System.IO.FileAttributes]::ReadOnly)
}