Initial commit from Weevil
This commit is contained in:
62
deploy.bat
Normal file
62
deploy.bat
Normal file
@@ -0,0 +1,62 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
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 - 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_PATH%" install -r "%APK%"
|
||||
|
||||
if errorlevel 1 (
|
||||
echo.
|
||||
echo Deployment failed!
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo Deployed!
|
||||
Reference in New Issue
Block a user