Skip to content

Commit 0ce1200

Browse files
authored
Update installer version and add tool installation checks
Updated installer version to 1.9.0 and added functions to ensure adb and ffmpeg are installed via winget.
1 parent 07dda10 commit 0ce1200

1 file changed

Lines changed: 68 additions & 1 deletion

File tree

deepstudio/xtester/install.ps1

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ param(
2424

2525
$ErrorActionPreference = "Stop"
2626

27-
$Script:InstallerVersion = "1.8.0"
27+
$Script:InstallerVersion = "1.9.0"
2828

2929
# Force UTF-8 console output so winget's progress glyphs and other tool output
3030
# are not rendered as mojibake in legacy code-page consoles.
@@ -64,6 +64,40 @@ function Invoke-WithCleanPythonPath([scriptblock]$Script) {
6464
}
6565
}
6666

67+
function Stop-XTesterMcpProcesses {
68+
Invoke-Step "Stopping running X-Tester MCP processes" {
69+
try {
70+
$processes = @(Get-CimInstance Win32_Process -ErrorAction Stop | Where-Object {
71+
$_.Name -ieq "xtester-mcp.exe" -or ($_.CommandLine -and $_.CommandLine -match '(^|[\\/\s"''])(xtester-mcp)(\.exe)?([\s"'']|$)')
72+
})
73+
}
74+
catch {
75+
Warn "Could not inspect running processes: $($_.Exception.Message)"
76+
return
77+
}
78+
79+
if ($processes.Count -eq 0) {
80+
Info "No running xtester-mcp processes found."
81+
return
82+
}
83+
84+
foreach ($entry in $processes) {
85+
$label = "$($entry.Name) pid=$($entry.ProcessId)"
86+
Info "Stopping $label"
87+
try {
88+
$process = Get-Process -Id $entry.ProcessId -ErrorAction Stop
89+
if ($process.CloseMainWindow()) {
90+
if ($process.WaitForExit(2000)) { continue }
91+
}
92+
Stop-Process -Id $entry.ProcessId -Force -ErrorAction Stop
93+
}
94+
catch {
95+
Warn "Could not stop ${label}: $($_.Exception.Message)"
96+
}
97+
}
98+
}
99+
}
100+
67101
function Require-Command([string]$Name, [string]$InstallHint) {
68102
$cmd = Get-Command $Name -ErrorAction SilentlyContinue
69103
if ($cmd) { return $cmd.Source }
@@ -638,6 +672,39 @@ $pythonInfo = Resolve-Python
638672
$pythonInvocation = @($pythonInfo.FilePath) + $pythonInfo.Arguments
639673
Success "Using Python: $($pythonInfo.Version) ($($pythonInvocation -join ' '))"
640674

675+
# Pre-install optional runtime tools that XTester needs for specific flows:
676+
# adb (Google.PlatformTools) — required for Android device automation
677+
# ffmpeg (Gyan.FFmpeg) — required for Windows screen recording
678+
# The skills detect missing tools at runtime, but pre-installing avoids
679+
# first-run friction for new users.
680+
Invoke-Step "Ensuring adb (Android platform-tools) is available" {
681+
if (Get-Command "adb" -ErrorAction SilentlyContinue) {
682+
Info "adb already on PATH."
683+
} else {
684+
$winget = Get-Command "winget" -ErrorAction SilentlyContinue
685+
if ($winget) {
686+
Info "Installing Google.PlatformTools via winget..."
687+
& $winget.Source install --id Google.PlatformTools -e --accept-source-agreements --accept-package-agreements --silent --disable-interactivity 2>&1 | ForEach-Object { Write-Host " $_" }
688+
} else {
689+
Warn "winget not available; install Android platform-tools manually and ensure adb is on PATH."
690+
}
691+
}
692+
}
693+
Invoke-Step "Ensuring ffmpeg is available" {
694+
if (Get-Command "ffmpeg" -ErrorAction SilentlyContinue) {
695+
Info "ffmpeg already on PATH."
696+
} else {
697+
$winget = Get-Command "winget" -ErrorAction SilentlyContinue
698+
if ($winget) {
699+
Info "Installing Gyan.FFmpeg via winget..."
700+
& $winget.Source install --id Gyan.FFmpeg --accept-package-agreements --accept-source-agreements --silent --disable-interactivity 2>&1 | ForEach-Object { Write-Host " $_" }
701+
} else {
702+
Warn "winget not available; install ffmpeg manually and ensure it is on PATH."
703+
}
704+
}
705+
}
706+
707+
Stop-XTesterMcpProcesses
641708
$venvPython = New-ManagedVenv $pythonInfo
642709
Install-XTesterIntoVenv $venvPython
643710
$xtesterMcp = Resolve-XTesterMcpFromVenv

0 commit comments

Comments
 (0)