param([string]$ToolRoot='C:\Users\Administrator\Documents\ChatGPT\优创未来\services\toplc-vpn-android\.tools') $ErrorActionPreference='Stop' $source=Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path) $stage=Join-Path $env:TEMP ('ZhaoPhoneModel-'+[guid]::NewGuid().ToString('N')) New-Item -ItemType Directory -Path $stage | Out-Null $jdk=Join-Path $ToolRoot 'jdk-staging\jdk-21.0.12.1+1' $files=@('PhonePowerModel','PhoneHomeSession','LocationCadence','VoiceGesture','ServerEndpoint') | ForEach-Object {Join-Path $source "src\cn\ucvl\zhaodisplay\$_.java"} $tests=@('PhonePowerModelTest','LocationCadenceTest','VoiceGestureTest','ServerEndpointTest') | ForEach-Object {Join-Path $source "tests\$_.java"} & "$jdk\bin\javac.exe" -encoding UTF-8 -d $stage @files @tests if($LASTEXITCODE){throw 'Phone model Java compilation failed'} foreach($test in @('PhonePowerModelTest','LocationCadenceTest','VoiceGestureTest','ServerEndpointTest')){ & "$jdk\bin\java.exe" -cp $stage "cn.ucvl.zhaodisplay.$test" if($LASTEXITCODE){throw "$test failed"} }