diff --git a/backend/mpc-system/services/service-party-android/build-apk.bat b/backend/mpc-system/services/service-party-android/build-apk.bat index b7ace430..fbe60ff9 100644 --- a/backend/mpc-system/services/service-party-android/build-apk.bat +++ b/backend/mpc-system/services/service-party-android/build-apk.bat @@ -75,6 +75,82 @@ echo [INFO] Using SDK from local.properties type local.properties echo. +:: Check and build tsslib.aar if needed +if not exist "app\libs\tsslib.aar" ( + echo [INFO] tsslib.aar not found, attempting to build TSS library... + echo. + + :: Check if Go is installed + where go >nul 2>nul + if !errorlevel! neq 0 ( + echo [ERROR] Go is not installed or not in PATH! + echo Please install Go from https://golang.org/dl/ + pause + exit /b 1 + ) + + :: Check if gomobile is installed + where gomobile >nul 2>nul + if !errorlevel! neq 0 ( + echo [INFO] gomobile not found, installing... + go install golang.org/x/mobile/cmd/gomobile@latest + if !errorlevel! neq 0 ( + echo [ERROR] Failed to install gomobile! + pause + exit /b 1 + ) + :: Initialize gomobile + gomobile init + ) + + :: Get the tsslib directory path (relative to service-party-android) + set "TSSLIB_DIR=..\..\libs\tsslib" + + if not exist "!TSSLIB_DIR!\go.mod" ( + echo [ERROR] TSS library source not found at !TSSLIB_DIR! + echo Please ensure the tsslib source code exists. + pause + exit /b 1 + ) + + echo [INFO] Building tsslib.aar with gomobile... + pushd "!TSSLIB_DIR!" + + :: Run go mod tidy first + go mod tidy + if !errorlevel! neq 0 ( + echo [ERROR] go mod tidy failed! + popd + pause + exit /b 1 + ) + + :: Build the AAR + gomobile bind -target=android -o "..\..\services\service-party-android\app\libs\tsslib.aar" . + if !errorlevel! neq 0 ( + echo [ERROR] gomobile bind failed! + popd + pause + exit /b 1 + ) + + popd + + if exist "app\libs\tsslib.aar" ( + echo [SUCCESS] tsslib.aar built successfully! + for %%F in ("app\libs\tsslib.aar") do echo Size: %%~zF bytes + ) else ( + echo [ERROR] tsslib.aar was not created! + pause + exit /b 1 + ) + echo. +) else ( + echo [INFO] tsslib.aar found, skipping TSS library build + for %%F in ("app\libs\tsslib.aar") do echo Size: %%~zF bytes + echo. +) + :: Parse command line arguments set BUILD_TYPE=all if "%1"=="debug" set BUILD_TYPE=debug