guoyu/log/备份/ps1/内层_sync-from-outer.ps1
2025-12-07 00:11:06 +08:00

63 lines
2.6 KiB
PowerShell

# Sync from outer project to inner project
$ErrorActionPreference = "Stop"
$Outer = Split-Path $PSScriptRoot
$Inner = $PSScriptRoot
Write-Host "Syncing from outer to inner project..."
Write-Host "Outer: $Outer"
Write-Host "Inner: $Inner"
Write-Host ""
# Copy Vosk AAR
Write-Host "[1/4] Copying Vosk AAR library..."
$VoskSource = "$Outer\uni_modules\xwq-speech-to-text\utssdk\app-android\libs\vosk-android-0.3.47.aar"
$VoskDest = "$Inner\src\uni_modules\xwq-speech-to-text\utssdk\app-android\libs\"
if (Test-Path $VoskSource) {
New-Item -ItemType Directory -Path $VoskDest -Force | Out-Null
Copy-Item -Path $VoskSource -Destination $VoskDest -Force
Write-Host " OK: Vosk AAR copied" -ForegroundColor Green
} else {
Write-Host " ERROR: Vosk AAR not found in outer project!" -ForegroundColor Red
exit 1
}
# Copy UTS plugin source
Write-Host "[2/4] Copying UTS plugin source..."
$UtsSource = "$Outer\uni_modules\xwq-speech-to-text\utssdk\app-android"
$UtsDest = "$Inner\src\uni_modules\xwq-speech-to-text\utssdk\app-android"
Copy-Item -Path "$UtsSource\*.uts" -Destination $UtsDest -Force -ErrorAction SilentlyContinue
Copy-Item -Path "$UtsSource\config.json" -Destination $UtsDest -Force -ErrorAction SilentlyContinue
Copy-Item -Path "$UtsSource\AndroidManifest.xml" -Destination $UtsDest -Force -ErrorAction SilentlyContinue
Write-Host " OK: UTS plugin source copied" -ForegroundColor Green
# Verify
Write-Host "[3/4] Verifying..."
$VoskFile = "$Inner\src\uni_modules\xwq-speech-to-text\utssdk\app-android\libs\vosk-android-0.3.47.aar"
$IndexFile = "$Inner\src\uni_modules\xwq-speech-to-text\utssdk\app-android\index.uts"
if ((Test-Path $VoskFile) -and (Test-Path $IndexFile)) {
$size = (Get-Item $VoskFile).Length / 1MB
Write-Host " OK: Vosk AAR exists ($([math]::Round($size, 2)) MB)" -ForegroundColor Green
Write-Host " OK: UTS plugin exists" -ForegroundColor Green
} else {
Write-Host " ERROR: Verification failed!" -ForegroundColor Red
exit 1
}
# Done
Write-Host "[4/4] Sync complete!" -ForegroundColor Green
Write-Host ""
Write-Host "Inner project is now complete with:" -ForegroundColor Cyan
Write-Host " - IP config (192.168.1.8)" -ForegroundColor Gray
Write-Host " - Vosk voice library" -ForegroundColor Gray
Write-Host " - Speech recognition plugin" -ForegroundColor Gray
Write-Host ""
Write-Host "You can now safely delete the outer project." -ForegroundColor Green
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Yellow
Write-Host " 1. npm run build:app" -ForegroundColor Cyan
Write-Host " 2. .\integrate-to-android-studio.ps1" -ForegroundColor Cyan