2021-02-01 20:37:07 +00:00
|
|
|
@echo off
|
|
|
|
|
|
|
|
setlocal
|
2021-02-01 21:20:30 +00:00
|
|
|
|
2022-04-06 22:19:44 +00:00
|
|
|
set BUILD_TYPE=release
|
2022-04-08 17:14:53 +00:00
|
|
|
set VERSION=0.31.1-multiview
|
2022-03-23 20:48:01 +00:00
|
|
|
|
|
|
|
@REM Define the following environment variables to sign a release build
|
|
|
|
@REM set KEYSTORE=
|
|
|
|
@REM set KEYSTORE_PASS=
|
|
|
|
|
2022-02-04 20:42:34 +00:00
|
|
|
|
2021-02-01 20:51:36 +00:00
|
|
|
set ANDROID_SDK_ROOT=%AppData%\..\Local\Android\Sdk
|
|
|
|
set adb="%ANDROID_SDK_ROOT%\platform-tools\adb.exe"
|
|
|
|
set make="%ANDROID_SDK_ROOT%\ndk\21.1.6352462\prebuilt\windows-x86_64\bin\make.exe"
|
2022-01-29 15:45:18 +00:00
|
|
|
set apksigner="%ANDROID_SDK_ROOT%\build-tools\29.0.2\apksigner.bat"
|
2021-02-01 20:37:07 +00:00
|
|
|
set JAVA_HOME=C:\Program Files\Android\Android Studio\jre\jre
|
2022-02-04 20:42:34 +00:00
|
|
|
|
|
|
|
if "%1"=="clean" (
|
|
|
|
rm -rf .\build
|
|
|
|
rm -rf .\android\build
|
2022-02-15 23:25:28 +00:00
|
|
|
rm -rf .\android\app\src\main\jniLibs\arm64-v8a
|
2022-02-04 20:42:34 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
if %BUILD_TYPE%==release (
|
|
|
|
set GRADLE_BUILD_TYPE=:app:assembleRelease
|
|
|
|
)
|
|
|
|
if %BUILD_TYPE%==debug (
|
|
|
|
set GRADLE_BUILD_TYPE=:app:assembleDebug
|
|
|
|
)
|
2021-02-01 20:37:07 +00:00
|
|
|
|
2022-04-02 22:42:56 +00:00
|
|
|
REM package our special pk3
|
|
|
|
pushd android\app\src\main
|
|
|
|
call make_pakQ3Q.bat
|
|
|
|
popd
|
|
|
|
|
2022-03-11 19:16:44 +00:00
|
|
|
echo #define Q3QVERSION "%VERSION%" > .\android\app\src\main\cpp\code\vr\vr_version.h
|
|
|
|
|
2021-02-01 21:20:30 +00:00
|
|
|
pushd %~dp0\..
|
2022-01-29 15:45:18 +00:00
|
|
|
%make% -j %NUMBER_OF_PROCESSORS% %BUILD_TYPE%
|
2021-02-01 20:37:07 +00:00
|
|
|
|
|
|
|
if %ERRORLEVEL% NEQ 0 (
|
2021-02-01 21:20:30 +00:00
|
|
|
popd
|
2021-02-01 20:37:07 +00:00
|
|
|
echo "Failed to build ioq3"
|
|
|
|
exit /b 1
|
|
|
|
)
|
|
|
|
|
2021-02-01 21:20:30 +00:00
|
|
|
pushd android
|
2021-02-01 20:37:07 +00:00
|
|
|
|
|
|
|
set GRADLE_EXIT_CONSOLE=1
|
2022-01-29 15:45:18 +00:00
|
|
|
call gradlew.bat %GRADLE_BUILD_TYPE%
|
2021-02-01 20:37:07 +00:00
|
|
|
|
|
|
|
if %ERRORLEVEL% NEQ 0 (
|
2021-02-01 21:20:30 +00:00
|
|
|
popd
|
|
|
|
popd
|
2021-02-01 20:37:07 +00:00
|
|
|
echo "Failed to build android project"
|
|
|
|
exit /b 1
|
|
|
|
)
|
|
|
|
|
2022-02-04 20:42:34 +00:00
|
|
|
set PACKAGE_NAME=com.drbeef.ioq3quest
|
|
|
|
set ANDROID_STORAGE_LOCATION=/sdcard/ioquake3quest/
|
|
|
|
set APK_LOCATION=.\app\build\outputs\apk\%BUILD_TYPE%\ioq3quest-%BUILD_TYPE%-%VERSION%.apk
|
|
|
|
|
|
|
|
if %BUILD_TYPE%==release (
|
|
|
|
echo "Signing Release APK"
|
|
|
|
call %apksigner% sign --ks ../%KEYSTORE% --out %APK_LOCATION% --v2-signing-enabled true --ks-pass pass:%KEYSTORE_PASS% .\app\build\outputs\apk\%BUILD_TYPE%\app-%BUILD_TYPE%-unsigned.apk
|
|
|
|
)
|
2022-01-29 15:45:18 +00:00
|
|
|
|
2022-02-04 20:42:34 +00:00
|
|
|
if %BUILD_TYPE%==debug (
|
|
|
|
echo "Copying Debug APK"
|
|
|
|
copy .\app\build\outputs\apk\%BUILD_TYPE%\app-%BUILD_TYPE%.apk %APK_LOCATION%
|
|
|
|
)
|
2021-02-01 20:37:07 +00:00
|
|
|
|
2022-02-15 23:25:28 +00:00
|
|
|
if "%1"=="nodeploy" (
|
|
|
|
goto :END
|
|
|
|
)
|
|
|
|
|
2021-02-01 20:37:07 +00:00
|
|
|
%adb% install -r %APK_LOCATION%
|
|
|
|
if %ERRORLEVEL% NEQ 0 (
|
|
|
|
%adb% uninstall %PACKAGE_NAME%
|
|
|
|
%adb% install %APK_LOCATION%
|
|
|
|
if %ERRORLEVEL% NEQ 0 (
|
2021-02-01 21:20:30 +00:00
|
|
|
popd
|
|
|
|
popd
|
2021-02-01 20:37:07 +00:00
|
|
|
echo "Failed to install apk."
|
|
|
|
exit /b 1
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2022-02-15 23:25:28 +00:00
|
|
|
@REM %adb% shell mkdir -p %ANDROID_STORAGE_LOCATION%
|
|
|
|
@REM %adb% push --sync "D:\Program Files (x86)\Steam\steamapps\common\Quake 3 Arena\baseq3" %ANDROID_STORAGE_LOCATION%
|
|
|
|
@REM if %ERRORLEVEL% NEQ 0 (
|
|
|
|
@REM popd
|
|
|
|
@REM popd
|
|
|
|
@REM echo "Failed to transfer files."
|
|
|
|
@REM exit /b 1
|
|
|
|
@REM )
|
|
|
|
|
|
|
|
@REM %adb% push --sync ..\code\renderergl2\glsl %ANDROID_STORAGE_LOCATION%/baseq3/
|
|
|
|
@REM if %ERRORLEVEL% NEQ 0 (
|
|
|
|
@REM popd
|
|
|
|
@REM popd
|
|
|
|
@REM echo "Failed to transfer shaders."
|
|
|
|
@REM exit /b 1
|
|
|
|
@REM )
|
|
|
|
|
|
|
|
@REM %adb% push --sync autoexec.cfg %ANDROID_STORAGE_LOCATION%/baseq3/
|
|
|
|
@REM if %ERRORLEVEL% NEQ 0 (
|
|
|
|
@REM popd
|
|
|
|
@REM popd
|
|
|
|
@REM echo "Failed to transfer autoexec."
|
|
|
|
@REM exit /b 1
|
|
|
|
@REM )
|
2021-02-01 20:37:07 +00:00
|
|
|
|
|
|
|
%adb% logcat -c
|
|
|
|
%adb% shell am start -n %PACKAGE_NAME%/.MainActivity
|
|
|
|
if %ERRORLEVEL% NEQ 0 (
|
2021-02-01 21:20:30 +00:00
|
|
|
popd
|
|
|
|
popd
|
2021-02-01 20:37:07 +00:00
|
|
|
echo "Failed to start application."
|
|
|
|
exit 1
|
|
|
|
)
|
|
|
|
%adb% logcat *:S Quake3:V SDL:V DEBUG:V
|
2022-02-15 23:25:28 +00:00
|
|
|
|
|
|
|
:END
|
2021-02-01 20:37:07 +00:00
|
|
|
endlocal
|