26 lines
1.3 KiB
PowerShell
26 lines
1.3 KiB
PowerShell
# Rebuild only the Java 11 diagnostic JAR. Works on Windows and Linux PowerShell.
|
|
[CmdletBinding()]
|
|
param()
|
|
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference = 'Stop'
|
|
$Root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
|
$Source = Join-Path $Root 'hmi-docs/cheerpj/NativeLoaderSmoke.java'
|
|
$Helper = Join-Path $Root 'hmi-frontend/public/cheerpj/jaas-identity-bridge.jar'
|
|
$Dest = Join-Path $Root 'hmi-frontend/public/cheerpj/jaas-native-loader-smoke.jar'
|
|
if (!(Test-Path $Helper)) { & (Join-Path $Root 'hmi-scripts/build-jaas-bridge.ps1') }
|
|
$Temp = Join-Path ([System.IO.Path]::GetTempPath()) ('hmi-native-' + [Guid]::NewGuid().ToString('N'))
|
|
New-Item -ItemType Directory -Path $Temp -Force | Out-Null
|
|
try {
|
|
& javac --release 11 -cp $Helper -d $Temp $Source
|
|
if ($LASTEXITCODE -ne 0) { throw 'javac --release 11 failed' }
|
|
& jar --create --file $Dest -C $Temp 'com/widgetworkbench/cheerpj/NativeLoaderSmoke.class'
|
|
if ($LASTEXITCODE -ne 0) { throw 'JAR creation failed' }
|
|
$entries = @(& jar tf $Dest)
|
|
if ($LASTEXITCODE -ne 0 -or ($entries -notcontains 'com/widgetworkbench/cheerpj/NativeLoaderSmoke.class')) {
|
|
throw 'JAR does not contain NativeLoaderSmoke.class'
|
|
}
|
|
Write-Host "Java 11 Diagnose-JAR erstellt: $Dest"
|
|
} finally {
|
|
Remove-Item -LiteralPath $Temp -Recurse -Force -ErrorAction SilentlyContinue
|
|
}
|