setlocal
rem if gradlew.bat does not exist, load the project once in android studio

rem get the version number from src/version.h
SETLOCAL
SET "filename1=src/version.h"
SET "itemlist=VERSION_MAJOR VERSION_MINOR VERSION_PATCH"
FOR /f "usebackqtokens=1-3*" %%a IN ("%filename1%") DO (
 FOR %%i IN (%itemlist%) DO IF /i "%%b"=="%%i" SET "%%b=%%c"
)
SET "version=%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_PATCH%"

call android-quest3\gradlew.bat -b android-quest3/build.gradle assembleRelease
copy android-quest3\build\outputs\apk\release\Shr3D-release.apk shr3d-%version%-quest3.apk
