fix: Complete Windows deployment pipeline
Fixes critical bugs in Windows APK deployment workflow including APK path resolution, adb integration, and config file parsing. Changes: - Fix APK search to look for TeamCode-debug.apk instead of *app-debug.apk - Strip both single and double quotes from batch file path parsing - Add android_sdk_path to project configuration (.weevil.toml) - Resolve adb.exe from Android SDK platform-tools directory - Check adb install exit code and report deployment failures correctly - Add migration support for old .weevil.toml files missing android_sdk_path - Update all tests to use new ProjectConfig::new() signature The deployment workflow now properly finds the generated APK, locates adb, and reports success/failure accurately on Windows.
This commit is contained in:
@@ -77,7 +77,7 @@ impl ProjectBuilder {
|
||||
|
||||
fn create_project_files(&self, project_path: &Path, sdk_config: &SdkConfig) -> Result<()> {
|
||||
// Create .weevil.toml config
|
||||
let project_config = ProjectConfig::new(&self.name, sdk_config.ftc_sdk_path.clone())?;
|
||||
let project_config = ProjectConfig::new(&self.name, sdk_config.ftc_sdk_path.clone(), sdk_config.android_sdk_path.clone())?;
|
||||
project_config.save(project_path)?;
|
||||
|
||||
// README.md
|
||||
@@ -334,34 +334,62 @@ echo "✓ Deployed!"
|
||||
let deploy_bat = r#"@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
REM Read SDK path from config
|
||||
for /f "tokens=2 delims==" %%a in ('findstr /c:"ftc_sdk_path" .weevil.toml') do (
|
||||
set SDK_DIR=%%a
|
||||
set SDK_DIR=!SDK_DIR:"=!
|
||||
set SDK_DIR=!SDK_DIR: =!
|
||||
)
|
||||
REM Read SDK paths from config
|
||||
for /f "tokens=2 delims==" %%a in ('findstr /c:"ftc_sdk_path" .weevil.toml') do set SDK_DIR=%%a
|
||||
for /f "tokens=2 delims==" %%a in ('findstr /c:"android_sdk_path" .weevil.toml') do set ANDROID_SDK=%%a
|
||||
|
||||
REM Strip all quotes (both single and double)
|
||||
set SDK_DIR=%SDK_DIR:"=%
|
||||
set SDK_DIR=%SDK_DIR:'=%
|
||||
set SDK_DIR=%SDK_DIR: =%
|
||||
set ANDROID_SDK=%ANDROID_SDK:"=%
|
||||
set ANDROID_SDK=%ANDROID_SDK:'=%
|
||||
set ANDROID_SDK=%ANDROID_SDK: =%
|
||||
|
||||
if not defined SDK_DIR (
|
||||
echo Error: Could not read FTC SDK path from .weevil.toml
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if not defined ANDROID_SDK (
|
||||
echo Error: Could not read Android SDK path from .weevil.toml
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Set ADB path
|
||||
set ADB_PATH=%ANDROID_SDK%\platform-tools\adb.exe
|
||||
|
||||
echo Building APK...
|
||||
call gradlew.bat buildApk
|
||||
|
||||
echo.
|
||||
echo Deploying to Control Hub...
|
||||
|
||||
REM Find APK
|
||||
for /f "delims=" %%i in ('dir /s /b "%SDK_DIR%\*app-debug.apk" 2^>nul') do set APK=%%i
|
||||
REM Find APK - look for TeamCode-debug.apk
|
||||
for /f "delims=" %%i in ('dir /s /b "%SDK_DIR%\TeamCode-debug.apk" 2^>nul') do set APK=%%i
|
||||
|
||||
if not defined APK (
|
||||
echo Error: APK not found
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Found APK: %APK%
|
||||
|
||||
REM Check for adb
|
||||
if not exist "%ADB_PATH%" (
|
||||
echo Error: adb not found at %ADB_PATH%
|
||||
echo Run: weevil sdk install
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Installing: %APK%
|
||||
adb install -r "%APK%"
|
||||
"%ADB_PATH%" install -r "%APK%"
|
||||
|
||||
if errorlevel 1 (
|
||||
echo.
|
||||
echo Deployment failed!
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo Deployed!
|
||||
|
||||
Reference in New Issue
Block a user