feat(android): auto-build tsslib.aar if missing in build-apk.bat
When tsslib.aar is not found, the build script now automatically: 1. Checks if Go is installed 2. Installs gomobile if not present (go install golang.org/x/mobile/cmd/gomobile@latest) 3. Initializes gomobile if needed 4. Runs go mod tidy in the tsslib directory 5. Builds tsslib.aar using gomobile bind This allows building APKs on any machine with Go installed, without needing to manually compile the TSS library first. Requirements: - Go installed and in PATH - Android NDK (installed via Android SDK) 🤖 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
8541c83bf5
commit
131c14742c
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue