set MSYSTEM=MINGW%ARCH%
set MSYS2_PATH_TYPE=inherit
set CHERE_INVOKING=1

mkdir %SRC_DIR%\Rlibrary
set R_LIBS_USER=%SRC_DIR%\Rlibrary

FOR /F "DELIMS=. TOKENS=4" %%i IN ("%PKG_VERSION%") DO set buildnum=%%i
:: This strange syntax outputs a line without a newline at the end
<nul set /p ".=BUILD_NUMBER=%buildnum%" > gradle\buildnumber.properties

call ./gradlew.bat build --stacktrace -i -x tests

mkdir %PREFIX%\h2o_jar
MOVE build/h2o.jar %PREFIX%\h2o_jar\h2o.jar
