feat(android): add build-apk.bat script for easy APK building
Add Windows batch script for building Android APKs: - build-apk.bat debug - Build debug APK only - build-apk.bat release - Build release APK only - build-apk.bat - Build both debug and release APKs - build-apk.bat clean - Clean build files - build-apk.bat help - Show usage help Output locations: - Debug: app/build/outputs/apk/debug/app-debug.apk - Release: app/build/outputs/apk/release/app-release.apk 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
7b6d6de801
commit
4d62316d17
|
|
@ -0,0 +1,126 @@
|
|||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
echo ========================================
|
||||
echo TSS Party Android APK Builder
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
:: Check if gradlew exists
|
||||
if not exist "gradlew.bat" (
|
||||
echo [ERROR] gradlew.bat not found!
|
||||
echo Please run this script from the service-party-android directory.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: Parse command line arguments
|
||||
set BUILD_TYPE=all
|
||||
if "%1"=="debug" set BUILD_TYPE=debug
|
||||
if "%1"=="release" set BUILD_TYPE=release
|
||||
if "%1"=="clean" set BUILD_TYPE=clean
|
||||
if "%1"=="help" goto :show_help
|
||||
|
||||
:: Show build type
|
||||
echo Build type: %BUILD_TYPE%
|
||||
echo.
|
||||
|
||||
:: Clean build
|
||||
if "%BUILD_TYPE%"=="clean" (
|
||||
echo [1/1] Cleaning build files...
|
||||
call gradlew.bat clean --no-daemon
|
||||
if !errorlevel! neq 0 (
|
||||
echo [ERROR] Clean failed!
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
echo.
|
||||
echo [SUCCESS] Clean completed!
|
||||
goto :end
|
||||
)
|
||||
|
||||
:: Build Debug APK
|
||||
if "%BUILD_TYPE%"=="debug" goto :build_debug
|
||||
if "%BUILD_TYPE%"=="all" goto :build_debug
|
||||
goto :check_release
|
||||
|
||||
:build_debug
|
||||
echo [1/2] Building Debug APK...
|
||||
call gradlew.bat assembleDebug --no-daemon
|
||||
if !errorlevel! neq 0 (
|
||||
echo [ERROR] Debug build failed!
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
echo [SUCCESS] Debug APK built successfully!
|
||||
echo Location: app\build\outputs\apk\debug\app-debug.apk
|
||||
echo.
|
||||
|
||||
:check_release
|
||||
if "%BUILD_TYPE%"=="debug" goto :show_results
|
||||
|
||||
:: Build Release APK
|
||||
:build_release
|
||||
echo [2/2] Building Release APK...
|
||||
call gradlew.bat assembleRelease --no-daemon
|
||||
if !errorlevel! neq 0 (
|
||||
echo [ERROR] Release build failed!
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
echo [SUCCESS] Release APK built successfully!
|
||||
echo Location: app\build\outputs\apk\release\app-release.apk
|
||||
echo.
|
||||
|
||||
:show_results
|
||||
echo ========================================
|
||||
echo Build Results
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
:: Check and show Debug APK
|
||||
if exist "app\build\outputs\apk\debug\app-debug.apk" (
|
||||
for %%F in ("app\build\outputs\apk\debug\app-debug.apk") do (
|
||||
echo [DEBUG APK]
|
||||
echo Path: %%~fF
|
||||
echo Size: %%~zF bytes
|
||||
)
|
||||
echo.
|
||||
)
|
||||
|
||||
:: Check and show Release APK
|
||||
if exist "app\build\outputs\apk\release\app-release.apk" (
|
||||
for %%F in ("app\build\outputs\apk\release\app-release.apk") do (
|
||||
echo [RELEASE APK]
|
||||
echo Path: %%~fF
|
||||
echo Size: %%~zF bytes
|
||||
)
|
||||
echo.
|
||||
)
|
||||
|
||||
echo ========================================
|
||||
echo Build completed successfully!
|
||||
echo ========================================
|
||||
goto :end
|
||||
|
||||
:show_help
|
||||
echo.
|
||||
echo Usage: build-apk.bat [option]
|
||||
echo.
|
||||
echo Options:
|
||||
echo debug - Build debug APK only
|
||||
echo release - Build release APK only
|
||||
echo all - Build both debug and release APKs (default)
|
||||
echo clean - Clean build files
|
||||
echo help - Show this help message
|
||||
echo.
|
||||
echo Examples:
|
||||
echo build-apk.bat - Build both APKs
|
||||
echo build-apk.bat debug - Build debug APK only
|
||||
echo build-apk.bat release - Build release APK only
|
||||
echo build-apk.bat clean - Clean project
|
||||
echo.
|
||||
|
||||
:end
|
||||
echo.
|
||||
pause
|
||||
Loading…
Reference in New Issue